logstash-filter-varnishlog 0.1.1 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f6e3188bdffdfe92d62f542480eb7e554c14886c
4
- data.tar.gz: 12fd295aea608fca1ab481e5cfaa59bc4d9b3c54
3
+ metadata.gz: e1d5430d9891df7eb05a936e6ea8907bfd538491
4
+ data.tar.gz: 7c73df4fdfda351524e23f4fc9b3b05e369d63b3
5
5
  SHA512:
6
- metadata.gz: 0e12b49f6ece97158f12fe423fd63710fe2193209c0b361d3a91d450da6167e553b0268995fc4147a43393b164f497f6b7ab1c275fc11cf50394327ab1fd4c99
7
- data.tar.gz: 531064d5d9c9ed71695f94580f2e4e14692b043f4042c65e9b1d468d975bf837a64a2d9ead38e8385742a1c96e3a77b97fa06dbe2c31e6decda268b9a0e22efc
6
+ metadata.gz: 890fc12eb2d59be5950e5b2e5fc6df51adbd20ce4cafc0d4283ba8ab88a36abbc722366585b2ba04e0d6efd842aff86934aaf82612283bccd006fe83de517fb6
7
+ data.tar.gz: e4a20a07ae22ebe61cc6dc17bac9acc51867dac7c17436d848147bb234e910a815d6ca5cb2edd3cd0aed42836e53cd6ee7455f1d89ea8306a200fc98763815a9
@@ -40,9 +40,13 @@ class LogStash::Filters::Varnishlog < LogStash::Filters::Base
40
40
  end
41
41
  ## VCL Log
42
42
  vcl_log = items.grep(/VCL_Log/)
43
- vcl_log.each do |log|
43
+ log_lines = []
44
+ vcl_log.each_with_index do |log, index|
44
45
  if match = /-\s+VCL_Log\s+(?<log_line>.*)/.match(log)
45
- (log_lines ||= []).push(match['log_line'])
46
+ log_lines.push(match['log_line'])
47
+ event.set("[VCL_Log][#{index}]", log_lines)
48
+ end
49
+ if index == log_lines.size - 1
46
50
  event.set("VCL_Log", log_lines)
47
51
  end
48
52
  end
@@ -81,15 +85,25 @@ class LogStash::Filters::Varnishlog < LogStash::Filters::Base
81
85
  event.set("RespProtocol", protocol_match['protocol'])
82
86
  end
83
87
  ## Match RespStatus
84
- if status_match = /-\s+RespStatus\s+(?<status>.*)/.match(items.grep(/RespStatus/)[0])
85
- event.set("RespStatus", status_match['status'].to_i)
88
+ status_match = items.grep(/RespStatus/)
89
+ states = []
90
+ status_match.each_with_index do |status, index|
91
+ if match = /-\s+RespStatus\s+(?<status>.*)/.match(status)
92
+ states.push(match['status'].to_i)
93
+ end
94
+ if index == status_match.size - 1
95
+ event.set("RespStatus", states)
96
+ end
86
97
  end
87
98
  ## Match RespReason
88
99
  response_reason = items.grep(/RespReason/)
89
- response_reason.each do |reason|
100
+ reasons = []
101
+ response_reason.each_with_index do |reason, index|
90
102
  if match = /-\s+RespReason\s+(?<reason>.*)/.match(reason)
91
- (reasons ||= []).push(match['reason'])
92
- event.set("RespReason", reasons)
103
+ reasons.push(match['reason'])
104
+ end
105
+ if index == response_reason.size - 1
106
+ event.set("RespReason", reasons)
93
107
  end
94
108
  end
95
109
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-filter-varnishlog'
3
- s.version = '0.1.1'
3
+ s.version = '0.1.2'
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.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Herweg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-07 00:00:00.000000000 Z
11
+ date: 2018-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement