logstash-filter-elapsed 4.0.1 → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +10 -1
- data/docs/index.asciidoc +168 -0
- data/logstash-filter-elapsed.gemspec +2 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43e924f29e3b509fea49ef12c4531b121261f39a
|
4
|
+
data.tar.gz: 4264b3f6734b7348557956407327fc6d6dd2cb50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c53920e39bb270d975dc066b2f58f273f909f83aa6b18ff2000215593750644fcfa16bc226b1c7ecc704d46e9ba6d6a0b58bdac39689dfc8332a64966fa0197
|
7
|
+
data.tar.gz: 5199b7a5f0d6b619219823b3978fd8e534b558e8236c53096d22cec9d9a79d8c04709f139cdae6a2d443eb14de1413926476defdac7614a9690fb3c48b3ba5c7
|
data/Gemfile
CHANGED
@@ -1,2 +1,11 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
|
-
|
2
|
+
|
3
|
+
gemspec
|
4
|
+
|
5
|
+
logstash_path = ENV["LOGSTASH_PATH"] || "../../logstash"
|
6
|
+
use_logstash_source = ENV["LOGSTASH_SOURCE"] && ENV["LOGSTASH_SOURCE"].to_s == "1"
|
7
|
+
|
8
|
+
if Dir.exist?(logstash_path) && use_logstash_source
|
9
|
+
gem 'logstash-core', :path => "#{logstash_path}/logstash-core"
|
10
|
+
gem 'logstash-core-plugin-api', :path => "#{logstash_path}/logstash-core-plugin-api"
|
11
|
+
end
|
data/docs/index.asciidoc
ADDED
@@ -0,0 +1,168 @@
|
|
1
|
+
:plugin: elapsed
|
2
|
+
:type: filter
|
3
|
+
|
4
|
+
///////////////////////////////////////////
|
5
|
+
START - GENERATED VARIABLES, DO NOT EDIT!
|
6
|
+
///////////////////////////////////////////
|
7
|
+
:version: %VERSION%
|
8
|
+
:release_date: %RELEASE_DATE%
|
9
|
+
:changelog_url: %CHANGELOG_URL%
|
10
|
+
:include_path: ../../../../logstash/docs/include
|
11
|
+
///////////////////////////////////////////
|
12
|
+
END - GENERATED VARIABLES, DO NOT EDIT!
|
13
|
+
///////////////////////////////////////////
|
14
|
+
|
15
|
+
[id="plugins-{type}-{plugin}"]
|
16
|
+
|
17
|
+
=== Elapsed filter plugin
|
18
|
+
|
19
|
+
include::{include_path}/plugin_header.asciidoc[]
|
20
|
+
|
21
|
+
==== Description
|
22
|
+
|
23
|
+
The elapsed filter tracks a pair of start/end events and uses their
|
24
|
+
timestamps to calculate the elapsed time between them.
|
25
|
+
|
26
|
+
The filter has been developed to track the execution time of processes and
|
27
|
+
other long tasks.
|
28
|
+
|
29
|
+
The configuration looks like this:
|
30
|
+
[source,ruby]
|
31
|
+
filter {
|
32
|
+
elapsed {
|
33
|
+
start_tag => "start event tag"
|
34
|
+
end_tag => "end event tag"
|
35
|
+
unique_id_field => "id field name"
|
36
|
+
timeout => seconds
|
37
|
+
new_event_on_match => true/false
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
The events managed by this filter must have some particular properties.
|
42
|
+
The event describing the start of the task (the "start event") must contain
|
43
|
+
a tag equal to `start_tag`. On the other side, the event describing the end
|
44
|
+
of the task (the "end event") must contain a tag equal to `end_tag`. Both
|
45
|
+
these two kinds of event need to own an ID field which identify uniquely that
|
46
|
+
particular task. The name of this field is stored in `unique_id_field`.
|
47
|
+
|
48
|
+
You can use a Grok filter to prepare the events for the elapsed filter.
|
49
|
+
An example of configuration can be:
|
50
|
+
[source,ruby]
|
51
|
+
filter {
|
52
|
+
grok {
|
53
|
+
match => { "message" => "%{TIMESTAMP_ISO8601} START id: (?<task_id>.*)" }
|
54
|
+
add_tag => [ "taskStarted" ]
|
55
|
+
}
|
56
|
+
|
57
|
+
grok {
|
58
|
+
match => { "message" => "%{TIMESTAMP_ISO8601} END id: (?<task_id>.*)" }
|
59
|
+
add_tag => [ "taskTerminated" ]
|
60
|
+
}
|
61
|
+
|
62
|
+
elapsed {
|
63
|
+
start_tag => "taskStarted"
|
64
|
+
end_tag => "taskTerminated"
|
65
|
+
unique_id_field => "task_id"
|
66
|
+
}
|
67
|
+
}
|
68
|
+
|
69
|
+
The elapsed filter collects all the "start events". If two, or more, "start
|
70
|
+
events" have the same ID, only the first one is recorded, the others are
|
71
|
+
discarded.
|
72
|
+
|
73
|
+
When an "end event" matching a previously collected "start event" is
|
74
|
+
received, there is a match. The configuration property `new_event_on_match`
|
75
|
+
tells where to insert the elapsed information: they can be added to the
|
76
|
+
"end event" or a new "match event" can be created. Both events store the
|
77
|
+
following information:
|
78
|
+
|
79
|
+
* the tags `elapsed` and `elapsed_match`
|
80
|
+
* the field `elapsed_time` with the difference, in seconds, between
|
81
|
+
the two events timestamps
|
82
|
+
* an ID filed with the task ID
|
83
|
+
* the field `elapsed_timestamp_start` with the timestamp of the start event
|
84
|
+
|
85
|
+
If the "end event" does not arrive before "timeout" seconds, the
|
86
|
+
"start event" is discarded and an "expired event" is generated. This event
|
87
|
+
contains:
|
88
|
+
|
89
|
+
* the tags `elapsed` and `elapsed_expired_error`
|
90
|
+
* a field called `elapsed_time` with the age, in seconds, of the
|
91
|
+
"start event"
|
92
|
+
* an ID filed with the task ID
|
93
|
+
* the field `elapsed_timestamp_start` with the timestamp of the "start event"
|
94
|
+
|
95
|
+
|
96
|
+
[id="plugins-{type}s-{plugin}-options"]
|
97
|
+
==== Elapsed Filter Configuration Options
|
98
|
+
|
99
|
+
This plugin supports the following configuration options plus the <<plugins-{type}s-{plugin}-common-options>> described later.
|
100
|
+
|
101
|
+
[cols="<,<,<",options="header",]
|
102
|
+
|=======================================================================
|
103
|
+
|Setting |Input type|Required
|
104
|
+
| <<plugins-{type}s-{plugin}-end_tag>> |<<string,string>>|Yes
|
105
|
+
| <<plugins-{type}s-{plugin}-new_event_on_match>> |<<boolean,boolean>>|No
|
106
|
+
| <<plugins-{type}s-{plugin}-start_tag>> |<<string,string>>|Yes
|
107
|
+
| <<plugins-{type}s-{plugin}-timeout>> |<<number,number>>|No
|
108
|
+
| <<plugins-{type}s-{plugin}-unique_id_field>> |<<string,string>>|Yes
|
109
|
+
|=======================================================================
|
110
|
+
|
111
|
+
Also see <<plugins-{type}s-{plugin}-common-options>> for a list of options supported by all
|
112
|
+
filter plugins.
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
[id="plugins-{type}s-{plugin}-end_tag"]
|
117
|
+
===== `end_tag`
|
118
|
+
|
119
|
+
* This is a required setting.
|
120
|
+
* Value type is <<string,string>>
|
121
|
+
* There is no default value for this setting.
|
122
|
+
|
123
|
+
The name of the tag identifying the "end event"
|
124
|
+
|
125
|
+
[id="plugins-{type}s-{plugin}-new_event_on_match"]
|
126
|
+
===== `new_event_on_match`
|
127
|
+
|
128
|
+
* Value type is <<boolean,boolean>>
|
129
|
+
* Default value is `false`
|
130
|
+
|
131
|
+
This property manage what to do when an "end event" matches a "start event".
|
132
|
+
If it's set to `false` (default value), the elapsed information are added
|
133
|
+
to the "end event"; if it's set to `true` a new "match event" is created.
|
134
|
+
|
135
|
+
[id="plugins-{type}s-{plugin}-start_tag"]
|
136
|
+
===== `start_tag`
|
137
|
+
|
138
|
+
* This is a required setting.
|
139
|
+
* Value type is <<string,string>>
|
140
|
+
* There is no default value for this setting.
|
141
|
+
|
142
|
+
The name of the tag identifying the "start event"
|
143
|
+
|
144
|
+
[id="plugins-{type}s-{plugin}-timeout"]
|
145
|
+
===== `timeout`
|
146
|
+
|
147
|
+
* Value type is <<number,number>>
|
148
|
+
* Default value is `1800`
|
149
|
+
|
150
|
+
The amount of seconds after an "end event" can be considered lost.
|
151
|
+
The corresponding "start event" is discarded and an "expired event"
|
152
|
+
is generated. The default value is 30 minutes (1800 seconds).
|
153
|
+
|
154
|
+
[id="plugins-{type}s-{plugin}-unique_id_field"]
|
155
|
+
===== `unique_id_field`
|
156
|
+
|
157
|
+
* This is a required setting.
|
158
|
+
* Value type is <<string,string>>
|
159
|
+
* There is no default value for this setting.
|
160
|
+
|
161
|
+
The name of the field containing the task ID.
|
162
|
+
This value must uniquely identify the task in the system, otherwise
|
163
|
+
it's impossible to match the couple of events.
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
[id="plugins-{type}s-{plugin}-common-options"]
|
168
|
+
include::{include_path}/{type}.asciidoc[]
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'logstash-filter-elapsed'
|
4
|
-
s.version = '4.0.
|
4
|
+
s.version = '4.0.2'
|
5
5
|
s.licenses = ['Apache License (2.0)']
|
6
6
|
s.summary = "This filter tracks a pair of start/end events and calculates the elapsed time between them."
|
7
7
|
s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
|
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.require_paths = ["lib"]
|
12
12
|
|
13
13
|
# Files
|
14
|
-
s.files = Dir[
|
14
|
+
s.files = Dir["lib/**/*","spec/**/*","*.gemspec","*.md","CONTRIBUTORS","Gemfile","LICENSE","NOTICE.TXT", "vendor/jar-dependencies/**/*.jar", "vendor/jar-dependencies/**/*.rb", "VERSION", "docs/**/*"]
|
15
15
|
|
16
16
|
# Tests
|
17
17
|
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-filter-elapsed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -56,6 +56,7 @@ files:
|
|
56
56
|
- LICENSE
|
57
57
|
- NOTICE.TXT
|
58
58
|
- README.md
|
59
|
+
- docs/index.asciidoc
|
59
60
|
- lib/logstash/filters/elapsed.rb
|
60
61
|
- logstash-filter-elapsed.gemspec
|
61
62
|
- spec/filters/elapsed_spec.rb
|