vidibus-wowza_log_parser 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/vidibus/wowza_log_parser.rb +14 -3
  2. metadata +2 -2
@@ -1,9 +1,10 @@
1
1
  module Vidibus
2
2
  class WowzaLogParser
3
- VERSION = '0.1.0'
3
+ VERSION = '0.1.1'
4
4
  FIELDS = 'date time tz x-event x-category x-severity x-status x-ctx x-comment x-vhost x-app x-appinst x-duration s-ip s-port s-uri c-ip c-proto c-referrer c-user-agent c-client-id cs-bytes sc-bytes x-stream-id x-spos cs-stream-bytes sc-stream-bytes x-sname x-sname-query x-file-name x-file-ext x-file-size x-file-length x-suri x-suri-stem x-suri-query cs-uri-stem cs-uri-query'
5
5
  MATCHERS = {
6
6
  '_field' => '([^\s]+)',
7
+ '_tab' => '\t',
7
8
  '_space' => '\s+',
8
9
  'x-status' => '((?:\d+|-))',
9
10
  'x-comment' => '(.+)',
@@ -42,8 +43,18 @@ module Vidibus
42
43
  output = []
43
44
  input.split(/\n+/).each do |line|
44
45
  next if filter && !line.match(filter)
45
- if match = line.match(regex)
46
- values = match.to_a[1..-1]
46
+ values = nil
47
+ if matchers['_tab']
48
+ values = fields.split(matchers['_tab'])
49
+ end
50
+ unless values && values.count == keys.count
51
+ if match = line.match(regex)
52
+ values = match.to_a[1..-1]
53
+ else
54
+ values = nil
55
+ end
56
+ end
57
+ if values
47
58
  output << Hash[[keys, values].transpose].reject {|k,v| v == '-'}
48
59
  end
49
60
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vidibus-wowza_log_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -133,7 +133,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
133
133
  version: '0'
134
134
  segments:
135
135
  - 0
136
- hash: -672349600621671041
136
+ hash: 2324181824774713751
137
137
  required_rubygems_version: !ruby/object:Gem::Requirement
138
138
  none: false
139
139
  requirements: