splog 0.0.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 +15 -0
- data/.gitignore +54 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +150 -0
- data/Rakefile +1 -0
- data/bin/splog +5 -0
- data/examples/.splog.yml +96 -0
- data/examples/access_log +50 -0
- data/lib/splog/version.rb +3 -0
- data/lib/splog.rb +495 -0
- data/splog.gemspec +29 -0
- data/test/examples/apache/.splog.yml +39 -0
- data/test/examples/apache/access_log +50 -0
- data/test/examples/apache/debug_error_log +15 -0
- data/test/examples/apache/simple_access_log +2 -0
- data/test/examples/jboss/.splog.yml +47 -0
- data/test/examples/jboss/multiline_match_server.log +5 -0
- data/test/examples/jboss/multiline_match_unmatch_server.log +9 -0
- data/test/splog_spec.rb +287 -0
- metadata +142 -0
@@ -0,0 +1,47 @@
|
|
1
|
+
# Data Types supported ['DateTime' 'Integer', 'Float', 'String']
|
2
|
+
jboss_log4j_common:
|
3
|
+
db_key:
|
4
|
+
delim: '_'
|
5
|
+
values:
|
6
|
+
- '--key'
|
7
|
+
- '--file'
|
8
|
+
# Delimeter to join the regex array lines. Apache access is space delimited
|
9
|
+
delim: '\s+'
|
10
|
+
# Regex to be joined to parse each log line
|
11
|
+
# <!-- The default pattern: Date Priority [Category] (Thread) Message\n -->
|
12
|
+
# <param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n"/>
|
13
|
+
# (?<Date>.*?)\s+(?<Priority>WARN|ERROR|INFO|TRACE|DEBUG)\s+\[(?<Category>.*?)\]\s+\((?<Thread>.*?)\)\s+(?<Message>.*)
|
14
|
+
regex:
|
15
|
+
- '(?<Date>.*?)'
|
16
|
+
- '(?<Priority>WARN|ERROR|INFO|TRACE|DEBUG)'
|
17
|
+
- '\[(?<Category>.*?)\]'
|
18
|
+
- '\((?<Thread>.*?)\)'
|
19
|
+
- '(?<Message>.*)'
|
20
|
+
# For lines that don't match the regex above, define a key name if you want the log line
|
21
|
+
# TO be appended to a previously matched line
|
22
|
+
unmatched_append_key_name: 'Message'
|
23
|
+
# Define a regex pattern to define any matched lines to append to the previously matched line
|
24
|
+
# Example: 03 Oct 2013 20:16:55,309 ERROR [stderr] (MSC service thread 1-3) at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:116)
|
25
|
+
match_forward_regex:
|
26
|
+
- '(?<Date>.*?)'
|
27
|
+
- '(?<Priority>WARN|ERROR|INFO|TRACE|DEBUG)'
|
28
|
+
- '\[(?<Category>.*?)\]'
|
29
|
+
- '\((?<Thread>.*?)\)'
|
30
|
+
- '(?<Message>\tat\s.*)$'
|
31
|
+
|
32
|
+
mapping:
|
33
|
+
- name: Date
|
34
|
+
data_type: DateTime
|
35
|
+
format: '%d %b %Y %H:%M:%S,%L'
|
36
|
+
|
37
|
+
# Define the hash key to read from, otherwise default to the entire line
|
38
|
+
match_forward_keyname_source: 'Message'
|
39
|
+
|
40
|
+
# Define the hash key to read to, Mandatory if match_forward_regex defined
|
41
|
+
match_forward_keyname_dest: 'Message'
|
42
|
+
# Any mappings not specified are assumed to be of type String
|
43
|
+
#mapping:
|
44
|
+
# - name: Status
|
45
|
+
# data_type: Integer
|
46
|
+
# - name: Size
|
47
|
+
# data_type: Integer
|
@@ -0,0 +1,5 @@
|
|
1
|
+
03 Oct 2013 20:16:55,308 ERROR [stderr] (MSC service thread 1-3) java.lang.IllegalStateException: EJBCLIENT000025: No EJB receiver available for handling
|
2
|
+
03 Oct 2013 20:16:55,308 ERROR [stderr] (MSC service thread 1-3) at org.jboss.ejb.client.EJBClientContext
|
3
|
+
03 Oct 2013 20:16:55,309 ERROR [stderr] (MSC service thread 1-3) at org.jboss.ejb.client.ReceiverInterceptor
|
4
|
+
03 Oct 2013 18:33:00,427 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 57) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
|
5
|
+
|
@@ -0,0 +1,9 @@
|
|
1
|
+
03 Oct 2013 20:16:55,308 ERROR [stderr] (MSC service thread 1-3) java.lang.IllegalStateException: EJBCLIENT000025: No EJB receiver available for handling
|
2
|
+
03 Oct 2013 20:16:55,308 ERROR [stderr] (MSC service thread 1-3) at org.jboss.ejb.client.EJBClientContext
|
3
|
+
03 Oct 2013 20:16:55,309 ERROR [stderr] (MSC service thread 1-3) at org.jboss.ejb.client.ReceiverInterceptor
|
4
|
+
03 Oct 2013 18:33:00,427 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 57) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
|
5
|
+
unmatched line 1 added to previous
|
6
|
+
unmatched line 2 added to previous
|
7
|
+
03 Oct 2013 20:16:55,308 ERROR [stderr] (MSC service thread 1-3) Should be parsed log line # 3
|
8
|
+
03 Oct 2013 20:16:55,308 ERROR [stderr] (MSC service thread 1-3) Should be parsed log line # 4
|
9
|
+
|
data/test/splog_spec.rb
ADDED
@@ -0,0 +1,287 @@
|
|
1
|
+
lib = File.expand_path('../../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'splog'
|
4
|
+
require 'rspec'
|
5
|
+
|
6
|
+
RSpec.configure do |config|
|
7
|
+
config.failure_color = :magenta
|
8
|
+
config.tty = true
|
9
|
+
config.color = true
|
10
|
+
end
|
11
|
+
|
12
|
+
# These can be executed with $ bundle exec rspec test
|
13
|
+
describe Splog::LogParser do
|
14
|
+
it 'hello world sanity check' do
|
15
|
+
'Hello World!'.should eql('Hello World!')
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should parse a access_log with the common pattern' do
|
19
|
+
config = {
|
20
|
+
'apache_common' => {
|
21
|
+
'delim' => '\s*',
|
22
|
+
'regex' => [
|
23
|
+
'(?<Host>\S+)',
|
24
|
+
'(?<Identity>\S+)',
|
25
|
+
'(?<User>\S+)',
|
26
|
+
'\[(?<Time>.+)\]',
|
27
|
+
'"(?<Request>.+)"',
|
28
|
+
'(?<Status>[0-9]+)',
|
29
|
+
'(?<Size>\S+)',
|
30
|
+
'"(?<Referer>.*)"',
|
31
|
+
'"(?<UserAgent>.*)"',
|
32
|
+
],
|
33
|
+
'mapping' => [
|
34
|
+
{
|
35
|
+
'name' => 'Time',
|
36
|
+
'data_type' => 'DateTime',
|
37
|
+
'format' => '%d/%b/%Y:%H:%M:%S %z'
|
38
|
+
},
|
39
|
+
{
|
40
|
+
'name' => 'Status',
|
41
|
+
'data_type' => 'Integer'
|
42
|
+
},
|
43
|
+
{
|
44
|
+
'name' => 'Size',
|
45
|
+
'data_type' => 'Integer'
|
46
|
+
},
|
47
|
+
]
|
48
|
+
}
|
49
|
+
}
|
50
|
+
log_example = <<-LOG
|
51
|
+
127.0.0.1 - - [25/Sep/2013:15:41:55 -0400] "ENABLE-APP / HTTP/1.0" 200 - "-" "ClusterListener/1.0"
|
52
|
+
127.0.0.2 - - [25/Sep/2013:15:42:30 -0400] "GET /mod_cluster-manager/ HTTP/1.1" 200 1360 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.3; MS-RTC LM 8)"
|
53
|
+
LOG
|
54
|
+
parser = Splog::LogParser.new
|
55
|
+
parser.config = config
|
56
|
+
options = {:pattern_name => 'apache_common', :output => 'test'}
|
57
|
+
parser.set_pattern(options)
|
58
|
+
parser.set_mapping(options)
|
59
|
+
# Get an enumerable from the string, ie enumerate the lines
|
60
|
+
e = parser.read_input(log_example)
|
61
|
+
# Get an enumerable from the parser
|
62
|
+
pe = parser.parse(e)
|
63
|
+
log_entry_one = pe.next
|
64
|
+
|
65
|
+
log_entry_one['Host'].should eql('127.0.0.1')
|
66
|
+
log_entry_one['Identity'].should eql('-')
|
67
|
+
log_entry_one['User'].should eql('-')
|
68
|
+
log_entry_one['Time'].to_s.should eql('2013-09-25 19:41:55 UTC')
|
69
|
+
log_entry_one['Time'].should be_a(Time)
|
70
|
+
log_entry_one['Request'].should eql('ENABLE-APP / HTTP/1.0')
|
71
|
+
log_entry_one['Status'].should eql(200)
|
72
|
+
log_entry_one['Status'].should be_a(Integer)
|
73
|
+
log_entry_one['Size'].should eql(0)
|
74
|
+
log_entry_one['Size'].should be_a(Integer)
|
75
|
+
log_entry_one['Referer'].should eql('-')
|
76
|
+
log_entry_one['UserAgent'].should eql('ClusterListener/1.0')
|
77
|
+
|
78
|
+
log_entry_two = pe.next
|
79
|
+
log_entry_two['Host'].should eql('127.0.0.2')
|
80
|
+
log_entry_two['Identity'].should eql('-')
|
81
|
+
log_entry_two['User'].should eql('-')
|
82
|
+
log_entry_two['Time'].to_s.should eql('2013-09-25 19:42:30 UTC')
|
83
|
+
log_entry_two['Time'].should be_a(Time)
|
84
|
+
log_entry_two['Request'].should eql('GET /mod_cluster-manager/ HTTP/1.1')
|
85
|
+
log_entry_two['Status'].should eql(200)
|
86
|
+
log_entry_two['Status'].should be_a(Integer)
|
87
|
+
log_entry_two['Size'].should eql(1360)
|
88
|
+
log_entry_two['Size'].should be_a(Integer)
|
89
|
+
log_entry_two['Referer'].should eql('-')
|
90
|
+
log_entry_two['UserAgent'].should eql('Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.3; MS-RTC LM 8)')
|
91
|
+
end
|
92
|
+
it 'jboss server.log log4j default, single log lines' do
|
93
|
+
config = {
|
94
|
+
'jboss_log4j_common' => {
|
95
|
+
'delim' => '\s+',
|
96
|
+
'regex' => [
|
97
|
+
'(?<Date>.*?)',
|
98
|
+
'(?<Priority>WARN|ERROR|INFO|TRACE|DEBUG)',
|
99
|
+
'\[(?<Category>.*?)\]',
|
100
|
+
'\((?<Thread>.*?)\)',
|
101
|
+
'(?<Message>.*)'
|
102
|
+
]
|
103
|
+
}
|
104
|
+
}
|
105
|
+
log_example = <<-LOG
|
106
|
+
03 Oct 2013 18:33:00,380 INFO [org.jboss.as.security] (ServerService Thread Pool -- 36) JBAS013171: Activating Security Subsystem
|
107
|
+
03 Oct 2013 18:33:00,419 DEBUG [org.jboss.as.webservices] (ServerService Thread Pool -- 32) JBAS015537: Activating WebServices Extension
|
108
|
+
LOG
|
109
|
+
parser = Splog::LogParser.new
|
110
|
+
parser.config = config
|
111
|
+
options = {:pattern_name => 'jboss_log4j_common', :output => 'test'}
|
112
|
+
parser.set_pattern(options)
|
113
|
+
parser.set_mapping(options)
|
114
|
+
# Get an enumerable from the string, ie enumerate the lines
|
115
|
+
e = parser.read_input(log_example)
|
116
|
+
# Get an enumerable from the parser
|
117
|
+
pe = parser.parse(e)
|
118
|
+
log_entry_one = pe.next
|
119
|
+
log_entry_one['Category'].should eql('org.jboss.as.security')
|
120
|
+
log_entry_one['Date'].should eql('03 Oct 2013 18:33:00,380')
|
121
|
+
log_entry_one['Message'].should eql("JBAS013171: Activating Security Subsystem\n")
|
122
|
+
log_entry_one['Priority'].should eql('INFO')
|
123
|
+
log_entry_one['Thread'].should eql('ServerService Thread Pool -- 36')
|
124
|
+
|
125
|
+
log_entry_two = pe.next
|
126
|
+
log_entry_two.should include(
|
127
|
+
'Category' => 'org.jboss.as.webservices',
|
128
|
+
'Date' => '03 Oct 2013 18:33:00,419',
|
129
|
+
'Message' => "JBAS015537: Activating WebServices Extension\n",
|
130
|
+
'Priority' => 'DEBUG',
|
131
|
+
'Thread' => 'ServerService Thread Pool -- 32',
|
132
|
+
)
|
133
|
+
end
|
134
|
+
it 'jboss server.log log4j default unmatched multiline log lines' do
|
135
|
+
config = {
|
136
|
+
'jboss_log4j_common' => {
|
137
|
+
'delim' => '\s+',
|
138
|
+
'regex' => [
|
139
|
+
'(?<Date>.*?)',
|
140
|
+
'(?<Priority>WARN|ERROR|INFO|TRACE|DEBUG)',
|
141
|
+
'\[(?<Category>.*?)\]',
|
142
|
+
'\((?<Thread>.*?)\)',
|
143
|
+
'(?<Message>.*)'
|
144
|
+
],
|
145
|
+
'unmatched_append_key_name' => 'Message',
|
146
|
+
'mapping' => [
|
147
|
+
{
|
148
|
+
'name' => 'Date',
|
149
|
+
'data_type' => 'DateTime',
|
150
|
+
'format' => '%d %b %Y %H:%M:%S,%L'
|
151
|
+
}
|
152
|
+
]
|
153
|
+
}
|
154
|
+
}
|
155
|
+
log_example = <<-LOG
|
156
|
+
03 Oct 2013 20:19:42,591 INFO [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-12) JNDI bindings for session bean named Z are as follows:
|
157
|
+
java:global/a/b/c!com.a.b.c.D
|
158
|
+
java:app/x/y!com.x.y.Z
|
159
|
+
LOG
|
160
|
+
parser = Splog::LogParser.new
|
161
|
+
parser.config = config
|
162
|
+
options = {:pattern_name => 'jboss_log4j_common', :output => 'test'}
|
163
|
+
parser.set_pattern(options)
|
164
|
+
parser.set_mapping(options)
|
165
|
+
# Get an enumerable from the string, ie enumerate the lines
|
166
|
+
e = parser.read_input(log_example)
|
167
|
+
# Get an enumerable from the parser
|
168
|
+
pe = parser.parse(e)
|
169
|
+
log_entry_one = pe.next
|
170
|
+
|
171
|
+
log_entry_one['Category'].should eql('org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor')
|
172
|
+
log_entry_one['Date'].to_s.should eql('2013-10-03 20:19:42 UTC')
|
173
|
+
log_entry_one['Date'].should be_a(Time)
|
174
|
+
log_entry_one['Message'].should eql("JNDI bindings for session bean named Z are as follows:\n\tjava:global/a/b/c!com.a.b.c.D\n\tjava:app/x/y!com.x.y.Z\n")
|
175
|
+
log_entry_one['Priority'].should eql('INFO')
|
176
|
+
log_entry_one['Thread'].should eql('MSC service thread 1-12')
|
177
|
+
end
|
178
|
+
|
179
|
+
# Match subsequent lines and add them to a previous line
|
180
|
+
it 'jboss server.log log4j default multiline matched log lines' do
|
181
|
+
test_dir = Dir.pwd.match(/.*?splog$/) ? 'test/' : ''
|
182
|
+
dot_file_path = File.expand_path("./#{test_dir}examples/jboss/.splog.yml")
|
183
|
+
server_log_name = File.expand_path("./#{test_dir}examples/jboss/multiline_match_server.log")
|
184
|
+
|
185
|
+
p "pwd: #{Dir.pwd}, test_dir: #{test_dir}, dot_file_path: #{dot_file_path}"
|
186
|
+
parser = Splog::LogParser.new
|
187
|
+
parser.cli(['-p', 'jboss_log4j_common','-f', server_log_name, '-c', dot_file_path, '-o', 'test'])
|
188
|
+
e = parser.read_log_file(parser.options[:file_name])
|
189
|
+
# Get an enumerable from the parser
|
190
|
+
pe = parser.parse(e)
|
191
|
+
log_entry_one = pe.next
|
192
|
+
log_entry_one['Category'].should eql('stderr')
|
193
|
+
log_entry_one['Date'].to_s.should eql('2013-10-03 20:16:55 UTC')
|
194
|
+
log_entry_one['Date'].should be_a(Time)
|
195
|
+
log_entry_one['Message'].should eql("java.lang.IllegalStateException: EJBCLIENT000025: No EJB receiver available for handling\n\tat org.jboss.ejb.client.EJBClientContext\n\tat org.jboss.ejb.client.ReceiverInterceptor\n")
|
196
|
+
log_entry_one['Priority'].should eql('ERROR')
|
197
|
+
log_entry_one['Thread'].should eql('MSC service thread 1-3')
|
198
|
+
|
199
|
+
#03 Oct 2013 18:33:00,427 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 57) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
|
200
|
+
log_entry_two = pe.next
|
201
|
+
log_entry_two['Category'].should eql('org.jboss.as.connector.subsystems.datasources')
|
202
|
+
log_entry_two['Date'].to_s.should eql('2013-10-03 18:33:00 UTC')
|
203
|
+
log_entry_two['Date'].should be_a(Time)
|
204
|
+
log_entry_two['Message'].should eql("JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)\n\n")
|
205
|
+
log_entry_two['Priority'].should eql('INFO')
|
206
|
+
log_entry_two['Thread'].should eql('ServerService Thread Pool -- 57')
|
207
|
+
end
|
208
|
+
|
209
|
+
# Match subsequent lines and add them to a previous line
|
210
|
+
it 'jboss server.log matched and unmatched lines' do
|
211
|
+
test_dir = Dir.pwd.match(/.*?splog$/) ? 'test/' : ''
|
212
|
+
dot_file_path = File.expand_path("./#{test_dir}examples/jboss/.splog.yml")
|
213
|
+
server_log_name = File.expand_path("./#{test_dir}examples/jboss/multiline_match_unmatch_server.log")
|
214
|
+
|
215
|
+
p "pwd: #{Dir.pwd}, test_dir: #{test_dir}, dot_file_path: #{dot_file_path}"
|
216
|
+
parser = Splog::LogParser.new
|
217
|
+
parser.cli(['-p', 'jboss_log4j_common','-f', server_log_name, '-c', dot_file_path, '-o', 'test'])
|
218
|
+
e = parser.read_log_file(parser.options[:file_name])
|
219
|
+
# Get an enumerable from the parser
|
220
|
+
pe = parser.parse(e)
|
221
|
+
parsed_lines = pe.to_a
|
222
|
+
parsed_lines.length.should eql(4)
|
223
|
+
end
|
224
|
+
|
225
|
+
|
226
|
+
it 'should properly hash the 50 lines in the sample access log' do
|
227
|
+
# Match subsequent lines and add them to a previous line
|
228
|
+
test_dir = Dir.pwd.match(/.*?splog$/) ? 'test/' : ''
|
229
|
+
dot_file_path = File.expand_path("#{test_dir}examples/apache/.splog.yml")
|
230
|
+
server_log_name = File.expand_path("#{test_dir}examples/apache/access_log")
|
231
|
+
|
232
|
+
parser = Splog::LogParser.new
|
233
|
+
parser.cli(['-p', 'apache_common','-f', server_log_name, '-c', dot_file_path, '-o', 'test'])
|
234
|
+
e = parser.read_log_file(parser.options[:file_name])
|
235
|
+
# Get an enumerable from the parser
|
236
|
+
pe = parser.parse(e)
|
237
|
+
parsed_lines = pe.to_a
|
238
|
+
parsed_lines.length.should eql(50)
|
239
|
+
end
|
240
|
+
|
241
|
+
it 'should properly parse a debug debug_error_log' do
|
242
|
+
# Match subsequent lines and add them to a previous line
|
243
|
+
test_dir = Dir.pwd.match(/.*?splog$/) ? 'test/' : ''
|
244
|
+
dot_file_path = File.expand_path("#{test_dir}examples/apache/.splog.yml")
|
245
|
+
server_log_name = File.expand_path("#{test_dir}examples/apache/debug_error_log")
|
246
|
+
|
247
|
+
parser = Splog::LogParser.new
|
248
|
+
parser.cli(['-p', 'apache_error','-f', server_log_name, '-c', dot_file_path, '-o', 'test'])
|
249
|
+
e = parser.read_log_file(parser.options[:file_name])
|
250
|
+
# Get an enumerable from the parser
|
251
|
+
pe = parser.parse(e)
|
252
|
+
parsed_lines = pe.to_a
|
253
|
+
parsed_lines.length.should eql(14)
|
254
|
+
|
255
|
+
#[Wed Oct 02 19:24:09 2013] [info] APR LDAP: Built with OpenLDAP LDAP SDK
|
256
|
+
log_entry_one = parsed_lines[0]
|
257
|
+
log_entry_one['Date'].to_s.should eql('2013-10-02 19:24:09 UTC')
|
258
|
+
log_entry_one['Date'].should be_a(Time)
|
259
|
+
log_entry_one['Severity'].should eql('info')
|
260
|
+
log_entry_one['Module'].should eql('APR LDAP:')
|
261
|
+
log_entry_one['Message'].should eql("Built with OpenLDAP LDAP SDK\n")
|
262
|
+
|
263
|
+
#[Wed Oct 02 19:27:10 2013] [debug] ajp_header.c(290): ajp_marshal_into_msgb: Header[30] [Connection] = [Keep-Alive]
|
264
|
+
log_entry_ten = parsed_lines[9]
|
265
|
+
log_entry_ten['Date'].to_s.should eql('2013-10-02 19:27:10 UTC')
|
266
|
+
log_entry_ten['Date'].should be_a(Time)
|
267
|
+
log_entry_ten['Severity'].should eql('debug')
|
268
|
+
log_entry_ten['Module'].should eql('ajp_header.c(290):')
|
269
|
+
log_entry_ten['Message'].should eql("ajp_marshal_into_msgb: Header[30] [Connection] = [Keep-Alive]\n")
|
270
|
+
end
|
271
|
+
|
272
|
+
it 'should output a json array' do
|
273
|
+
# Match subsequent lines and add them to a previous line
|
274
|
+
test_dir = Dir.pwd.match(/.*?splog$/) ? 'test/' : ''
|
275
|
+
dot_file_path = File.expand_path("#{test_dir}examples/apache/.splog.yml")
|
276
|
+
server_log_name = File.expand_path("#{test_dir}examples/apache/simple_access_log")
|
277
|
+
|
278
|
+
parser = Splog::LogParser.new
|
279
|
+
parser.cli(['-p', 'apache_common','-f', server_log_name, '-c', dot_file_path, '-o', 'json'])
|
280
|
+
e = parser.read_log_file(parser.options[:file_name])
|
281
|
+
# Get an enumerable from the parser
|
282
|
+
pe = parser.parse(e)
|
283
|
+
parsed_lines = pe.to_a
|
284
|
+
parsed_lines.length.should eql(2)
|
285
|
+
|
286
|
+
end
|
287
|
+
end
|
metadata
ADDED
@@ -0,0 +1,142 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: splog
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Samuel Mendenhall
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-10-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: mongo
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ! '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ! '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bson_ext
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.3'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.3'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ! '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '2.6'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '2.6'
|
83
|
+
description: Parse any log file with yml defined regex rules
|
84
|
+
email:
|
85
|
+
- Samuel.Mendenhall@gmail.com
|
86
|
+
executables:
|
87
|
+
- splog
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- .gitignore
|
92
|
+
- Gemfile
|
93
|
+
- LICENSE.txt
|
94
|
+
- README.md
|
95
|
+
- Rakefile
|
96
|
+
- bin/splog
|
97
|
+
- examples/.splog.yml
|
98
|
+
- examples/access_log
|
99
|
+
- lib/splog.rb
|
100
|
+
- lib/splog/version.rb
|
101
|
+
- splog.gemspec
|
102
|
+
- test/examples/apache/.splog.yml
|
103
|
+
- test/examples/apache/access_log
|
104
|
+
- test/examples/apache/debug_error_log
|
105
|
+
- test/examples/apache/simple_access_log
|
106
|
+
- test/examples/jboss/.splog.yml
|
107
|
+
- test/examples/jboss/multiline_match_server.log
|
108
|
+
- test/examples/jboss/multiline_match_unmatch_server.log
|
109
|
+
- test/splog_spec.rb
|
110
|
+
homepage: https://github.com/engineersamuel/splog
|
111
|
+
licenses:
|
112
|
+
- MIT
|
113
|
+
metadata: {}
|
114
|
+
post_install_message:
|
115
|
+
rdoc_options: []
|
116
|
+
require_paths:
|
117
|
+
- lib
|
118
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
119
|
+
requirements:
|
120
|
+
- - ! '>='
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '0'
|
123
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
|
+
requirements:
|
125
|
+
- - ! '>='
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: '0'
|
128
|
+
requirements: []
|
129
|
+
rubyforge_project:
|
130
|
+
rubygems_version: 2.0.3
|
131
|
+
signing_key:
|
132
|
+
specification_version: 4
|
133
|
+
summary: Parse any log file with yml defined regex rules
|
134
|
+
test_files:
|
135
|
+
- test/examples/apache/.splog.yml
|
136
|
+
- test/examples/apache/access_log
|
137
|
+
- test/examples/apache/debug_error_log
|
138
|
+
- test/examples/apache/simple_access_log
|
139
|
+
- test/examples/jboss/.splog.yml
|
140
|
+
- test/examples/jboss/multiline_match_server.log
|
141
|
+
- test/examples/jboss/multiline_match_unmatch_server.log
|
142
|
+
- test/splog_spec.rb
|