logstash-filter-varnishlog 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/logstash/filters/varnishlog.rb +18 -11
- data/logstash-filter-varnishlog.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c08d34b9ad5c2eae13c1dd98206da8454e621b4
|
4
|
+
data.tar.gz: e4d80155ac77d30b1f87ec044451b971a72ce2ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a913c38bb62a4d456d4750e4738344732acad406e1316ee654719afb27ef7d30ca52f02d4b1f43a6fb151a037509bd20b55fe8e41d833b23b5a0802fbd2137e
|
7
|
+
data.tar.gz: 4c8c91d49762da74d81a5ef7942dad4624349ba47a54e17b41022d4ad6fb84d51f7a24c738657dedd01db8deb9c9d22342cdda8100361fb635d92fad38cdf5b9
|
data/CHANGELOG.md
CHANGED
@@ -39,9 +39,16 @@ class LogStash::Filters::Varnishlog < LogStash::Filters::Base
|
|
39
39
|
public
|
40
40
|
def filter(event)
|
41
41
|
items = event.get("[message]").split("\n")
|
42
|
-
if request=/\*+\s+<<\s+(?<type>\w+)\s+>>\s
|
42
|
+
if request=/\*+\s+<<\s+(?<type>\w+)\s+>>\s+(?<xid>\d+)/.match(items[0])
|
43
43
|
event.set("type", request['type'].downcase)
|
44
|
+
event.set("xid", request['xid'])
|
44
45
|
end
|
46
|
+
|
47
|
+
##Begin
|
48
|
+
if first=/-+\s+Begin\s+(?<id>\w+\s\d+\s\w+)/.match(items[1])
|
49
|
+
event.set("begin", first['id'])
|
50
|
+
end
|
51
|
+
|
45
52
|
##Remove Blacklisted items from items hash
|
46
53
|
items = items.grepv(blacklist_sections.join("|")) if blacklist_sections.any?
|
47
54
|
##
|
@@ -49,7 +56,7 @@ class LogStash::Filters::Varnishlog < LogStash::Filters::Base
|
|
49
56
|
##timestamps
|
50
57
|
timestamps = items.grep(/Timestamp/)
|
51
58
|
timestamps.each do |timestamp|
|
52
|
-
if match =
|
59
|
+
if match = /-{1,2}\s+Timestamp\s+(?<step>\w{3,10}): (?<time_a>\d{10}\.\d{6}) (?<time_b>(0|\d+)\.\d{6}) (?<time_c>(0|\d+)\.\d{6})/.match(timestamp)
|
53
60
|
event.set(normalize_fields("timestamp_" + match['step'] ), match['time_a'])
|
54
61
|
event.set(normalize_fields("timestamp_" + match['step'] + "_raw"), match['time_a'] + " " + match['time_b'] + " " + match['time_c'])
|
55
62
|
end
|
@@ -76,22 +83,22 @@ class LogStash::Filters::Varnishlog < LogStash::Filters::Base
|
|
76
83
|
|
77
84
|
# Requests
|
78
85
|
## Request headers.
|
79
|
-
request_headers = items.grep(/(
|
86
|
+
request_headers = items.grep(/(Bereq|Req|Beresp|Resp)Header/)
|
80
87
|
request_headers.each do |header|
|
81
|
-
if match = /-+\s+(
|
88
|
+
if match = /-+\s+(Bereq|Req|Beresp|Resp)Header\s+(?<header_name>.+): (?<header_value>.*)/.match(header)
|
82
89
|
event.set(normalize_fields(match['header_name']), match['header_value'])
|
83
90
|
end
|
84
91
|
end
|
85
92
|
## Match ReqMethod.
|
86
|
-
if method_match = /-+\s+(
|
93
|
+
if method_match = /-+\s+(Bereq|Req|Beresp|Resp)Method\s+(?<method>.+)/.match(items.grep(/(Bereq|Req|Beresp|Resp)Method/)[0])
|
87
94
|
event.set("http_method", method_match['method'])
|
88
95
|
end
|
89
96
|
## Match ReqURL.
|
90
|
-
if url_match = /-+\s+(
|
97
|
+
if url_match = /-+\s+(Bereq|Req|Beresp|Resp)URL\s+(?<url>\/.+)/.match(items.grep(/(Bereq|Req|Beresp|Resp)URL/)[0])
|
91
98
|
event.set("url", url_match['url'])
|
92
99
|
end
|
93
100
|
## Match ReqProtocol.
|
94
|
-
if protocol_match = /-+\s+(
|
101
|
+
if protocol_match = /-+\s+(Bereq|Req|Beresp|Resp)Protocol\s+(?<protocol>.+)/.match(items.grep(/(Bereq|Req|Beresp|Resp)Protocol/)[0])
|
95
102
|
event.set("protocol", protocol_match['protocol'])
|
96
103
|
end
|
97
104
|
## FetchError.
|
@@ -99,10 +106,10 @@ class LogStash::Filters::Varnishlog < LogStash::Filters::Base
|
|
99
106
|
event.set("FetchError", error_match['error'])
|
100
107
|
end
|
101
108
|
## Match RespStatus
|
102
|
-
status_match = items.grep(/(
|
109
|
+
status_match = items.grep(/(Bereq|Req|Beresp|Resp)Status/)
|
103
110
|
states = []
|
104
111
|
status_match.each_with_index do |status, index|
|
105
|
-
if match = /-+\s+(
|
112
|
+
if match = /-+\s+(Bereq|Req|Beresp|Resp)Status\s+(?<status>\d{3})/.match(status)
|
106
113
|
states.push(match['status'].to_i)
|
107
114
|
end
|
108
115
|
if index == status_match.size - 1
|
@@ -110,10 +117,10 @@ class LogStash::Filters::Varnishlog < LogStash::Filters::Base
|
|
110
117
|
end
|
111
118
|
end
|
112
119
|
## Match RespReason
|
113
|
-
response_reason = items.grep(/(
|
120
|
+
response_reason = items.grep(/(Bereq|Req|Beresp|Resp)Reason/)
|
114
121
|
reasons = []
|
115
122
|
response_reason.each_with_index do |reason, index|
|
116
|
-
if match = /-+\s+(
|
123
|
+
if match = /-+\s+(Bereq|Req|Beresp|Resp)Reason\s+(?<reason>.+)/.match(reason)
|
117
124
|
reasons.push(match['reason'])
|
118
125
|
end
|
119
126
|
if index == response_reason.size - 1
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-filter-varnishlog'
|
3
|
-
s.version = '0.2.
|
3
|
+
s.version = '0.2.1'
|
4
4
|
s.licenses = ['Apache License (2.0)']
|
5
5
|
s.summary = 'A logstash plugin reading varnishlog output'
|
6
6
|
s.description = 'logstash filter plugin reading varnishlog grouped by id'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-filter-varnishlog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christian Herweg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|