logstash-filter-varnishlog 0.1.6 → 0.1.7
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/CHANGELOG.md +2 -0
- data/lib/logstash/filters/varnishlog.rb +25 -26
- 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: b5bad4a2635a7e8d23f99156c2bb9d7dda5ab37b
|
4
|
+
data.tar.gz: 3336e14b86616bf2ea870769eecc06851f26ed4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92d81615cc6f94db12c8dbf769922a0b9ab6f21c7d4f7d29169ea3395c6151caf6bbfdb921c819541050da4504bcb4675f7240c9eeb175fc319c5f490d1b0baf
|
7
|
+
data.tar.gz: 685985a711e67a5d8e1686493731b26e964f939840110d168cebbc620c6609dc8e2b278d4ab2879df9530bbf95e67a86664254f3984c3a1cd3292e983651f694
|
data/CHANGELOG.md
CHANGED
@@ -39,6 +39,9 @@ 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+/.match(items[0])
|
43
|
+
event.set("type", request['type'].downcase)
|
44
|
+
end
|
42
45
|
##Remove Blacklisted items from items hash
|
43
46
|
items = items.grepv(blacklist_sections.join("|")) if blacklist_sections.any?
|
44
47
|
##
|
@@ -50,6 +53,14 @@ class LogStash::Filters::Varnishlog < LogStash::Filters::Base
|
|
50
53
|
event.set(normalize_fields("timestamp_" + match['step'] ), match['time_a'])
|
51
54
|
end
|
52
55
|
end
|
56
|
+
|
57
|
+
##Acct
|
58
|
+
account = items.grep(/(Be|Req)Acct/)
|
59
|
+
account.each do |acct|
|
60
|
+
if acct_match = /-\s+(Be|Req)Acct\s+(?<size_a>\d)\s+(?<size_b>\d)\s+(?<size_c>\d)\s+(?<size_d>\d)\s+(?<size_e>\d)\s+(?<size_f>\d)\s+/.match(acct)
|
61
|
+
event.set("bytes", acct_match['size_e'])
|
62
|
+
end
|
63
|
+
end
|
53
64
|
## VCL Log
|
54
65
|
vcl_log = items.grep(/VCL_Log/)
|
55
66
|
log_lines = []
|
@@ -64,57 +75,45 @@ class LogStash::Filters::Varnishlog < LogStash::Filters::Base
|
|
64
75
|
|
65
76
|
# Requests
|
66
77
|
## Request headers.
|
67
|
-
request_headers = items.grep(/
|
78
|
+
request_headers = items.grep(/(Be)?([rR]eq|[rR]esp)Header/)
|
68
79
|
request_headers.each do |header|
|
69
|
-
if match = /-+\s+
|
80
|
+
if match = /-+\s+(Be)?([rR]eq|[rR]esp)Header\s+(?<header_name>.*?): (?<header_value>.*)/.match(header)
|
70
81
|
event.set(normalize_fields(match['header_name']), match['header_value'])
|
71
82
|
end
|
72
83
|
end
|
73
84
|
## Match ReqMethod.
|
74
|
-
if method_match = /-+\s+
|
75
|
-
event.set("
|
85
|
+
if method_match = /-+\s+(Be)?([rR]eq|[rR]esp)Method\s+(?<method>.*)/.match(items.grep(/(Be)?([rR]eq|[rR]esp)Method/)[0])
|
86
|
+
event.set("http_method", method_match['method'])
|
76
87
|
end
|
77
88
|
## Match ReqURL.
|
78
|
-
if url_match = /-+\s+
|
79
|
-
event.set("
|
89
|
+
if url_match = /-+\s+(Be)?([rR]eq|[rR]esp)URL\s+(?<url>\/.*)/.match(items.grep(/(Be)?([rR]eq|[rR]esp)URL/)[0])
|
90
|
+
event.set("url", url_match['url'])
|
80
91
|
end
|
81
92
|
## Match ReqProtocol.
|
82
|
-
if protocol_match = /-+\s+
|
83
|
-
event.set("
|
93
|
+
if protocol_match = /-+\s+(Be)?([rR]eq|[rR]esp)Protocol\s+(?<protocol>.*)/.match(items.grep(/(Be)?([rR]eq|[rR]esp)Protocol/)[0])
|
94
|
+
event.set("protocol", protocol_match['protocol'])
|
84
95
|
end
|
85
96
|
|
86
|
-
# Response
|
87
|
-
## Response headers.
|
88
|
-
response_headers = items.grep(/RespHeader/)
|
89
|
-
response_headers.each do |header|
|
90
|
-
if match = /-+\s+RespHeader\s+(?<header_name>.*?): (?<header_value>.*)/.match(header)
|
91
|
-
event.set(normalize_fields(match['header_name']), match['header_value'])
|
92
|
-
end
|
93
|
-
end
|
94
|
-
## Match RespProtocol
|
95
|
-
if protocol_match = /-+\s+RespProtocol\s+(?<protocol>.*)/.match(items.grep(/RespProtocol/)[0])
|
96
|
-
event.set("RespProtocol", protocol_match['protocol'])
|
97
|
-
end
|
98
97
|
## Match RespStatus
|
99
|
-
status_match = items.grep(/
|
98
|
+
status_match = items.grep(/(Be)?([rR]eq|[rR]esp)Status/)
|
100
99
|
states = []
|
101
100
|
status_match.each_with_index do |status, index|
|
102
|
-
if match = /-+\s+
|
101
|
+
if match = /-+\s+(Be)?([rR]eq|[rR]esp)Status\s+(?<status>.*)/.match(status)
|
103
102
|
states.push(match['status'].to_i)
|
104
103
|
end
|
105
104
|
if index == status_match.size - 1
|
106
|
-
event.set("
|
105
|
+
event.set("http-rc", states)
|
107
106
|
end
|
108
107
|
end
|
109
108
|
## Match RespReason
|
110
|
-
response_reason = items.grep(/
|
109
|
+
response_reason = items.grep(/(Be)?([rR]eq|[rR]esp)Reason/)
|
111
110
|
reasons = []
|
112
111
|
response_reason.each_with_index do |reason, index|
|
113
|
-
if match = /-+\s+
|
112
|
+
if match = /-+\s+(Be)?([rR]eq|[rR]esp)Reason\s+(?<reason>.*)/.match(reason)
|
114
113
|
reasons.push(match['reason'])
|
115
114
|
end
|
116
115
|
if index == response_reason.size - 1
|
117
|
-
event.set("
|
116
|
+
event.set("reason", reasons)
|
118
117
|
end
|
119
118
|
end
|
120
119
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-filter-varnishlog'
|
3
|
-
s.version = '0.1.
|
3
|
+
s.version = '0.1.7'
|
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.1.
|
4
|
+
version: 0.1.7
|
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-
|
11
|
+
date: 2018-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|