logstash-filter-varnishlog 0.1.9 → 0.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 522db1d86d5d2cee76999a1057b350e1bc09d0f5
4
- data.tar.gz: 32ccf64fc14e3f820ecf4e3cb5b76b629a5c7a23
3
+ metadata.gz: 2e70f08b94d6fa83c9151078e5c806b796418a4b
4
+ data.tar.gz: 9aed70b3bff1a9ab3518ef526d03067b343d8268
5
5
  SHA512:
6
- metadata.gz: 236c28124c363b288f951d7099ea37f70ff854f448f1628961e48560af196bf0705e1761bf6f87f29e2b36d9836fbba4154e3eb2040d20db9ec154bcbb8219b6
7
- data.tar.gz: 04d156686e2e8f6cbce96e796e51ad8054a521ea0ea624d2d51b2362d85071cf5eafbccebb8aa68267e8b71bee6063e802e9089b4aafe40aa534a15a90562613
6
+ metadata.gz: 82a1140cf06a4906c5f554f4e241c4ced35333c909c47eb66f17c2cf44867dac26fbbd640ff541f9accb8819fba48edfd9d2073242831b06befa72d3e81ce7a7
7
+ data.tar.gz: 818cf06c1a7d2508014ecff6cca6c4d72918dce3d6e0c9d8f8bd2a96ec04f7eb4b27e0c4b75779bb9333ea79adbd8cd2ac3d1b8c024a14316597fb1b0053f126
data/CHANGELOG.md CHANGED
@@ -1,3 +1,5 @@
1
+ ## 0.2.0
2
+ - Make better RegEx Patterns
1
3
  ## 0.1.9
2
4
  - Add Raw Timestamps
3
5
  ## 0.1.8
@@ -49,7 +49,7 @@ class LogStash::Filters::Varnishlog < LogStash::Filters::Base
49
49
  ##timestamps
50
50
  timestamps = items.grep(/Timestamp/)
51
51
  timestamps.each do |timestamp|
52
- if match = /-\s+Timestamp\s+(?<step>.*): (?<time_a>.*) (?<time_b>.*) (?<time_c>.*)/.match(timestamp)
52
+ if match = /-\s+Timestamp\s+(?<step>.+): (?<time_a>.*) (?<time_b>.+) (?<time_c>.+)/.match(timestamp)
53
53
  event.set(normalize_fields("timestamp_" + match['step'] ), match['time_a'])
54
54
  event.set(normalize_fields("timestamp_" + match['step'] + "_raw"), match['time_a'] + " " + match['time_b'] + " " + match['time_c'])
55
55
  end
@@ -66,7 +66,7 @@ class LogStash::Filters::Varnishlog < LogStash::Filters::Base
66
66
  vcl_log = items.grep(/VCL_Log/)
67
67
  log_lines = []
68
68
  vcl_log.each_with_index do |log, index|
69
- if match = /-\s+VCL_Log\s+(?<log_line>.*)/.match(log)
69
+ if match = /-\s+VCL_Log\s+(?<log_line>.+)/.match(log)
70
70
  log_lines.push(match['log_line'])
71
71
  end
72
72
  if index == log_lines.size - 1
@@ -78,31 +78,31 @@ class LogStash::Filters::Varnishlog < LogStash::Filters::Base
78
78
  ## Request headers.
79
79
  request_headers = items.grep(/(Be)?([rR]eq|[rR]esp)Header/)
80
80
  request_headers.each do |header|
81
- if match = /-+\s+(Be)?([rR]eq|[rR]esp)Header\s+(?<header_name>.*?): (?<header_value>.*)/.match(header)
81
+ if match = /-+\s+(Be)?([rR]eq|[rR]esp)Header\s+(?<header_name>.+): (?<header_value>.*)/.match(header)
82
82
  event.set(normalize_fields(match['header_name']), match['header_value'])
83
83
  end
84
84
  end
85
85
  ## Match ReqMethod.
86
- if method_match = /-+\s+(Be)?([rR]eq|[rR]esp)Method\s+(?<method>.*)/.match(items.grep(/(Be)?([rR]eq|[rR]esp)Method/)[0])
86
+ if method_match = /-+\s+(Be)?([rR]eq|[rR]esp)Method\s+(?<method>.+)/.match(items.grep(/(Be)?([rR]eq|[rR]esp)Method/)[0])
87
87
  event.set("http_method", method_match['method'])
88
88
  end
89
89
  ## Match ReqURL.
90
- if url_match = /-+\s+(Be)?([rR]eq|[rR]esp)URL\s+(?<url>\/.*)/.match(items.grep(/(Be)?([rR]eq|[rR]esp)URL/)[0])
90
+ if url_match = /-+\s+(Be)?([rR]eq|[rR]esp)URL\s+(?<url>\/.+)/.match(items.grep(/(Be)?([rR]eq|[rR]esp)URL/)[0])
91
91
  event.set("url", url_match['url'])
92
92
  end
93
93
  ## Match ReqProtocol.
94
- if protocol_match = /-+\s+(Be)?([rR]eq|[rR]esp)Protocol\s+(?<protocol>.*)/.match(items.grep(/(Be)?([rR]eq|[rR]esp)Protocol/)[0])
94
+ if protocol_match = /-+\s+(Be)?([rR]eq|[rR]esp)Protocol\s+(?<protocol>.+)/.match(items.grep(/(Be)?([rR]eq|[rR]esp)Protocol/)[0])
95
95
  event.set("protocol", protocol_match['protocol'])
96
96
  end
97
97
  ## FetchError.
98
- if error_match = /-+\s+FetchError\s+(?<error>.*)/.match(items.grep(/FetchError/)[0])
98
+ if error_match = /-+\s+FetchError\s+(?<error>.+)/.match(items.grep(/FetchError/)[0])
99
99
  event.set("FetchError", error_match['error'])
100
100
  end
101
101
  ## Match RespStatus
102
102
  status_match = items.grep(/(Be)?([rR]eq|[rR]esp)Status/)
103
103
  states = []
104
104
  status_match.each_with_index do |status, index|
105
- if match = /-+\s+(Be)?([rR]eq|[rR]esp)Status\s+(?<status>.*)/.match(status)
105
+ if match = /-+\s+(Be)?([rR]eq|[rR]esp)Status\s+(?<status>.+)/.match(status)
106
106
  states.push(match['status'].to_i)
107
107
  end
108
108
  if index == status_match.size - 1
@@ -113,7 +113,7 @@ class LogStash::Filters::Varnishlog < LogStash::Filters::Base
113
113
  response_reason = items.grep(/(Be)?([rR]eq|[rR]esp)Reason/)
114
114
  reasons = []
115
115
  response_reason.each_with_index do |reason, index|
116
- if match = /-+\s+(Be)?([rR]eq|[rR]esp)Reason\s+(?<reason>.*)/.match(reason)
116
+ if match = /-+\s+(Be)?([rR]eq|[rR]esp)Reason\s+(?<reason>.+)/.match(reason)
117
117
  reasons.push(match['reason'])
118
118
  end
119
119
  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.1.9'
3
+ s.version = '0.2.0'
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.9
4
+ version: 0.2.0
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-02 00:00:00.000000000 Z
11
+ date: 2018-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement