chainsaw 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -21,7 +21,7 @@ be found here: https://github.com/mojombo/chronic
21
21
  # You can use a hypen to specify a time range (you can mix and match formats)
22
22
 
23
23
  > chainsaw access.log 2012-08-01 - 2012-09-17 # entries within August 1st and September 17th
24
- > chainsaw access.log august - yesterday # entries within August and September
24
+ > chainsaw access.log july - yesterday # entries within July and yesterday
25
25
 
26
26
  ## Features
27
27
 
@@ -2,7 +2,7 @@ module Chainsaw
2
2
  class Detector
3
3
  PATTERNS = {
4
4
  :clf => {
5
- :pattern => /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} (?:-|[^ ]+) (?:-|[^ ]+) \[(\d{2}\/[a-z]{3}\/\d{4}:\d{2}:\d{2}:\d{2} -\d{4})\]/i,
5
+ :pattern => /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} (?:-|[^ ]+) (?:-|[^ ]+) \[(\d{2}\/[a-z]{3}\/\d{4}:\d{2}:\d{2}:\d{2} (-|\+)\d{4})\]/i,
6
6
  :time_format => '%d/%b/%Y:%H:%M:%S %z'
7
7
  },
8
8
  :apache_error => {
@@ -18,7 +18,7 @@ module Chainsaw
18
18
  :time_format => '%Y-%m-%dT%H:%M:%S'
19
19
  },
20
20
  :rails => {
21
- :pattern => /^started [a-z]+ "[^"]+" for \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} at (\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} -\d{4})/i,
21
+ :pattern => /^started [a-z]+ "[^"]+" for \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} at (\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} (-|\+)\d{4})/i,
22
22
  :time_format => '%Y-%m-%d %H:%M:%S %z'
23
23
  },
24
24
  :syslog => {
@@ -42,12 +42,16 @@ module Chainsaw
42
42
  :time_format => '%d/%b/%Y %H:%M:%S'
43
43
  },
44
44
  :python => {
45
- :pattern => /^(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})/i,
45
+ :pattern => /^(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}),\d{3}/i,
46
46
  :time_format => '%Y-%m-%d %H:%M:%S'
47
47
  },
48
48
  :django => {
49
49
  :pattern => /^\[(\d{2}\/[a-z]{3}\/\d{4} \d{2}:\d{2}:\d{2})\]/i,
50
50
  :time_format => '%d/%b/%Y %H:%M:%S'
51
+ },
52
+ :nslog => {
53
+ :pattern => /^(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})\.\d{3} [a-z0-9]+\[/i,
54
+ :time_format => '%Y-%m-%d %H:%M:%S'
51
55
  }
52
56
  }
53
57
 
@@ -1,3 +1,3 @@
1
1
  module Chainsaw
2
- VERSION = '0.0.7'
2
+ VERSION = '0.0.8'
3
3
  end
@@ -113,6 +113,14 @@ describe Chainsaw::Detector do
113
113
  time.must_equal Time.local(2012, 9, 03, 21, 49, 47)
114
114
  end
115
115
 
116
+ it 'detects nslog log format' do
117
+ line = get_log_line('nslog.log')
118
+ format = Detector.detect(line)
119
+ time = get_time(line, format)
120
+
121
+ format.type.must_equal :nslog
122
+ time.must_equal Time.local(2012, 8, 30, 04, 54, 48)
123
+ end
116
124
 
117
125
  def get_time(line, format)
118
126
  timestamp = line.match(format.pattern)[1]
@@ -0,0 +1,4 @@
1
+ 2012-08-30 04:54:48.128 MyApp[94652:a0f] some log message
2
+ 2012-08-30 04:54:50.647 MyApp[94652:a0f] another log message
3
+ 2012-08-31 04:54:48.128 MyApp[94652:a0f] some log message
4
+ 2012-08-31 04:54:50.647 MyApp[94652:a0f] another log message
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chainsaw
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-09-04 00:00:00.000000000 Z
13
+ date: 2012-09-14 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: chronic
17
- requirement: &70200863777840 !ruby/object:Gem::Requirement
17
+ requirement: &70343402535640 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 0.7.0
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70200863777840
25
+ version_requirements: *70343402535640
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rake
28
- requirement: &70200863776780 !ruby/object:Gem::Requirement
28
+ requirement: &70343402535000 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ~>
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: 0.9.2.2
34
34
  type: :development
35
35
  prerelease: false
36
- version_requirements: *70200863776780
36
+ version_requirements: *70343402535000
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: minitest
39
- requirement: &70200863776040 !ruby/object:Gem::Requirement
39
+ requirement: &70343402534380 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ~>
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: 3.0.0
45
45
  type: :development
46
46
  prerelease: false
47
- version_requirements: *70200863776040
47
+ version_requirements: *70343402534380
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: mocha
50
- requirement: &70200863775260 !ruby/object:Gem::Requirement
50
+ requirement: &70343402533340 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ~>
@@ -55,7 +55,7 @@ dependencies:
55
55
  version: 0.11.4
56
56
  type: :development
57
57
  prerelease: false
58
- version_requirements: *70200863775260
58
+ version_requirements: *70343402533340
59
59
  description: Filter logfiles based on a time range
60
60
  email:
61
61
  - tdunn13@gmail.com
@@ -87,6 +87,7 @@ files:
87
87
  - test/logs/django.log
88
88
  - test/logs/mongodb.log
89
89
  - test/logs/nginx_error.log
90
+ - test/logs/nslog.log
90
91
  - test/logs/puppet.log
91
92
  - test/logs/python.log
92
93
  - test/logs/rack.log
@@ -129,6 +130,7 @@ test_files:
129
130
  - test/logs/django.log
130
131
  - test/logs/mongodb.log
131
132
  - test/logs/nginx_error.log
133
+ - test/logs/nslog.log
132
134
  - test/logs/puppet.log
133
135
  - test/logs/python.log
134
136
  - test/logs/rack.log