jls-grok 0.2.3071 → 0.2.3089

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.
data/ext/extconf.rb CHANGED
@@ -1,6 +1,21 @@
1
1
  require "mkmf"
2
- find_header("tcutil.h", "/usr/local/include")
3
- find_header("pcre.h", "/usr/local/include")
4
- find_header("grok.h", "/usr/local/include", "../../")
5
- find_library("grok", "grok_init", "../", "../../", "/usr/local/lib")
2
+
3
+ # TODO(sissel): I don't think we need these two headers.
4
+ #if !find_header("tcutil.h", "/usr/local/include")
5
+ #if !find_header("pcre.h", "/usr/local/include")
6
+
7
+ if !find_header("grok.h", "/usr/local/include", "../../")
8
+ raise "Could not find grok.h"
9
+ end
10
+
11
+ if !find_library("sgrok", "grok_init", "../", "../../", "/usr/local/lib")
12
+ raise "Could not find libgrok, is it installed?"
13
+ end
14
+
6
15
  create_makefile("Grok")
16
+
17
+ #with_cflags("-g") do
18
+ #with_ldflags("-g") do
19
+ #create_makefile("Grok")
20
+ #end
21
+ #end
data/ext/mkmf.log CHANGED
@@ -1,36 +1,82 @@
1
- find_header: checking for tcutil.h in /usr/local/include... -------------------- yes
1
+ find_header: checking for grok.h in /usr/local/include,../../... -------------------- yes
2
2
 
3
3
  "gcc -E -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -fno-strict-aliasing -g -g -O2 -fPIC conftest.c -o conftest.i"
4
4
  checked program was:
5
5
  /* begin */
6
- 1: #include <tcutil.h>
6
+ 1: #include <grok.h>
7
7
  /* end */
8
8
 
9
9
  --------------------
10
10
 
11
- find_header: checking for pcre.h in /usr/local/include... -------------------- yes
11
+ find_library: checking for grok_init() in -lsgrok... -------------------- no
12
12
 
13
- "gcc -E -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -fno-strict-aliasing -g -g -O2 -fPIC conftest.c -o conftest.i"
13
+ "gcc -o conftest -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -fno-strict-aliasing -g -g -O2 -fPIC conftest.c -L. -L/usr/lib -L. -Wl,-Bsymbolic-functions -rdynamic -Wl,-export-dynamic -lruby1.8-static -lsgrok -lpthread -lrt -ldl -lcrypt -lm -lc"
14
+ conftest.c: In function 't':
15
+ conftest.c:3: error: 'grok_init' undeclared (first use in this function)
16
+ conftest.c:3: error: (Each undeclared identifier is reported only once
17
+ conftest.c:3: error: for each function it appears in.)
14
18
  checked program was:
15
19
  /* begin */
16
- 1: #include <pcre.h>
20
+ 1: /*top*/
21
+ 2: int main() { return 0; }
22
+ 3: int t() { void ((*volatile p)()); p = (void ((*)()))grok_init; return 0; }
17
23
  /* end */
18
24
 
19
- --------------------
25
+ "gcc -o conftest -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -fno-strict-aliasing -g -g -O2 -fPIC conftest.c -L. -L/usr/lib -L. -Wl,-Bsymbolic-functions -rdynamic -Wl,-export-dynamic -lruby1.8-static -lsgrok -lpthread -lrt -ldl -lcrypt -lm -lc"
26
+ /usr/bin/ld: cannot find -lsgrok
27
+ collect2: ld returned 1 exit status
28
+ checked program was:
29
+ /* begin */
30
+ 1: /*top*/
31
+ 2: int main() { return 0; }
32
+ 3: int t() { grok_init(); return 0; }
33
+ /* end */
20
34
 
21
- find_header: checking for grok.h in /usr/local/include,../../... -------------------- yes
35
+ "gcc -o conftest -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -fno-strict-aliasing -g -g -O2 -fPIC conftest.c -L. -L/usr/lib -L../ -L. -Wl,-Bsymbolic-functions -rdynamic -Wl,-export-dynamic -lruby1.8-static -lsgrok -lpthread -lrt -ldl -lcrypt -lm -lc"
36
+ conftest.c: In function 't':
37
+ conftest.c:3: error: 'grok_init' undeclared (first use in this function)
38
+ conftest.c:3: error: (Each undeclared identifier is reported only once
39
+ conftest.c:3: error: for each function it appears in.)
40
+ checked program was:
41
+ /* begin */
42
+ 1: /*top*/
43
+ 2: int main() { return 0; }
44
+ 3: int t() { void ((*volatile p)()); p = (void ((*)()))grok_init; return 0; }
45
+ /* end */
22
46
 
23
- "gcc -E -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -fno-strict-aliasing -g -g -O2 -fPIC conftest.c -o conftest.i"
47
+ "gcc -o conftest -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -fno-strict-aliasing -g -g -O2 -fPIC conftest.c -L. -L/usr/lib -L../ -L. -Wl,-Bsymbolic-functions -rdynamic -Wl,-export-dynamic -lruby1.8-static -lsgrok -lpthread -lrt -ldl -lcrypt -lm -lc"
48
+ /usr/bin/ld: cannot find -lsgrok
49
+ collect2: ld returned 1 exit status
24
50
  checked program was:
25
51
  /* begin */
26
- 1: #include <grok.h>
52
+ 1: /*top*/
53
+ 2: int main() { return 0; }
54
+ 3: int t() { grok_init(); return 0; }
27
55
  /* end */
28
56
 
29
- --------------------
57
+ "gcc -o conftest -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -fno-strict-aliasing -g -g -O2 -fPIC conftest.c -L. -L/usr/lib -L../../ -L. -Wl,-Bsymbolic-functions -rdynamic -Wl,-export-dynamic -lruby1.8-static -lsgrok -lpthread -lrt -ldl -lcrypt -lm -lc"
58
+ conftest.c: In function 't':
59
+ conftest.c:3: error: 'grok_init' undeclared (first use in this function)
60
+ conftest.c:3: error: (Each undeclared identifier is reported only once
61
+ conftest.c:3: error: for each function it appears in.)
62
+ checked program was:
63
+ /* begin */
64
+ 1: /*top*/
65
+ 2: int main() { return 0; }
66
+ 3: int t() { void ((*volatile p)()); p = (void ((*)()))grok_init; return 0; }
67
+ /* end */
30
68
 
31
- find_library: checking for grok_init() in -lgrok... -------------------- yes
69
+ "gcc -o conftest -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -fno-strict-aliasing -g -g -O2 -fPIC conftest.c -L. -L/usr/lib -L../../ -L. -Wl,-Bsymbolic-functions -rdynamic -Wl,-export-dynamic -lruby1.8-static -lsgrok -lpthread -lrt -ldl -lcrypt -lm -lc"
70
+ /usr/bin/ld: cannot find -lsgrok
71
+ collect2: ld returned 1 exit status
72
+ checked program was:
73
+ /* begin */
74
+ 1: /*top*/
75
+ 2: int main() { return 0; }
76
+ 3: int t() { grok_init(); return 0; }
77
+ /* end */
32
78
 
33
- "gcc -o conftest -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -fno-strict-aliasing -g -g -O2 -fPIC conftest.c -L. -L/usr/lib -L. -Wl,-Bsymbolic-functions -rdynamic -Wl,-export-dynamic -lruby1.8-static -lgrok -lpthread -lrt -ldl -lcrypt -lm -lc"
79
+ "gcc -o conftest -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -fno-strict-aliasing -g -g -O2 -fPIC conftest.c -L. -L/usr/lib -L/usr/local/lib -L. -Wl,-Bsymbolic-functions -rdynamic -Wl,-export-dynamic -lruby1.8-static -lsgrok -lpthread -lrt -ldl -lcrypt -lm -lc"
34
80
  conftest.c: In function 't':
35
81
  conftest.c:3: error: 'grok_init' undeclared (first use in this function)
36
82
  conftest.c:3: error: (Each undeclared identifier is reported only once
@@ -42,7 +88,9 @@ checked program was:
42
88
  3: int t() { void ((*volatile p)()); p = (void ((*)()))grok_init; return 0; }
43
89
  /* end */
44
90
 
45
- "gcc -o conftest -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -fno-strict-aliasing -g -g -O2 -fPIC conftest.c -L. -L/usr/lib -L. -Wl,-Bsymbolic-functions -rdynamic -Wl,-export-dynamic -lruby1.8-static -lgrok -lpthread -lrt -ldl -lcrypt -lm -lc"
91
+ "gcc -o conftest -I. -I/usr/lib/ruby/1.8/x86_64-linux -I. -fno-strict-aliasing -g -g -O2 -fPIC conftest.c -L. -L/usr/lib -L/usr/local/lib -L. -Wl,-Bsymbolic-functions -rdynamic -Wl,-export-dynamic -lruby1.8-static -lsgrok -lpthread -lrt -ldl -lcrypt -lm -lc"
92
+ /usr/bin/ld: cannot find -lsgrok
93
+ collect2: ld returned 1 exit status
46
94
  checked program was:
47
95
  /* begin */
48
96
  1: /*top*/
data/ext/ruby_grok.o CHANGED
Binary file
Binary file
data/ext/ruby_grokmatch.o CHANGED
Binary file
data/lib/grok/pile.rb CHANGED
@@ -45,7 +45,6 @@ class Grok::Pile
45
45
  def match(string)
46
46
  @groks.each do |grok|
47
47
  match = grok.match(string)
48
- #puts "Trying #{grok.pattern} against #{string}"
49
48
  if match
50
49
  return [grok, match]
51
50
  end
data/test/core ADDED
Binary file
@@ -0,0 +1,68 @@
1
+ require 'grok'
2
+ require 'test/unit'
3
+
4
+ class ISO8601PatternsTest < Test::Unit::TestCase
5
+ def setup
6
+ @grok = Grok.new
7
+ path = "#{File.dirname(__FILE__)}/../../../patterns/base"
8
+ @grok.add_patterns_from_file(path)
9
+ @grok.compile("^%{TIMESTAMP_ISO8601}$")
10
+ end
11
+
12
+ def test_iso8601
13
+ times = [
14
+ "2001-01-01T00:00:00",
15
+ "1974-03-02T04:09:09",
16
+ "2010-05-03T08:18:18+00:00",
17
+ "2004-07-04T12:27:27-00:00",
18
+ "2001-09-05T16:36:36+0000",
19
+ "2001-11-06T20:45:45-0000",
20
+ "2001-12-07T23:54:54Z",
21
+ "2001-01-01T00:00:00.123456",
22
+ "1974-03-02T04:09:09.123456",
23
+ "2010-05-03T08:18:18.123456+00:00",
24
+ "2004-07-04T12:27:27.123456-00:00",
25
+ "2001-09-05T16:36:36.123456+0000",
26
+ "2001-11-06T20:45:45.123456-0000",
27
+ "2001-12-07T23:54:54.123456Z",
28
+ "2001-12-07T23:54:60.123456Z", # '60' second is a leap second.
29
+ ]
30
+ times.each do |time|
31
+ match = @grok.match(time)
32
+ assert_not_equal(false, match, "Expected #{time} to match TIMESTAMP_ISO8601")
33
+ assert_equal(time, match.captures["TIMESTAMP_ISO8601"][0])
34
+ end
35
+ end
36
+
37
+ def test_iso8601_nomatch
38
+ times = [
39
+ "2001-13-01T00:00:00", # invalid month
40
+ "2001-00-01T00:00:00", # invalid month
41
+ "2001-01-00T00:00:00", # invalid day
42
+ "2001-01-32T00:00:00", # invalid day
43
+ "2001-01-aT00:00:00", # invalid day
44
+ "2001-01-1aT00:00:00", # invalid day
45
+ "2001-01-01Ta0:00:00", # invalid hour
46
+ "2001-01-01T0:00:00", # invalid hour
47
+ "2001-01-01T25:00:00", # invalid hour
48
+ "2001-01-01T01:60:00", # invalid minute
49
+ "2001-01-01T00:aa:00", # invalid minute
50
+ "2001-01-01T00:00:aa", # invalid second
51
+ "2001-01-01T00:00:-1", # invalid second
52
+ "2001-01-01T00:00:61", # invalid second
53
+ "2001-01-01T00:00:00A", # invalid timezone
54
+ "2001-01-01T00:00:00+", # invalid timezone
55
+ "2001-01-01T00:00:00+25", # invalid timezone
56
+ "2001-01-01T00:00:00+2500", # invalid timezone
57
+ "2001-01-01T00:00:00+25:00", # invalid timezone
58
+ "2001-01-01T00:00:00-25", # invalid timezone
59
+ "2001-01-01T00:00:00-2500", # invalid timezone
60
+ "2001-01-01T00:00:00-00:61", # invalid timezone
61
+ ]
62
+ times.each do |time|
63
+ match = @grok.match(time)
64
+ assert_equal(false, match, "Expected #{time} to not match TIMESTAMP_ISO8601")
65
+ end
66
+ end
67
+
68
+ end
data/test/speedtest.rb CHANGED
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- #require 'rubygems'
3
+ require 'rubygems'
4
4
  require 'Grok'
5
5
  #require 'ruby-prof'
6
6
  require 'pp'
7
7
 
8
8
  #RubyProf.start
9
9
 
10
- iterations = 20000
10
+ iterations = 100000
11
11
  pattern = "[A-z0-9_-]*\\[[0-9]+\\]"
12
12
 
13
13
  grok = Grok.new
@@ -35,7 +35,7 @@ groktime = time(iterations) do |line|
35
35
  matches[:grok] += 1
36
36
  m.captures["FOO"]
37
37
  else
38
- puts line
38
+ #puts line
39
39
  failures[:grok] +=1
40
40
  end
41
41
  end
@@ -49,6 +49,7 @@ end
49
49
  #end
50
50
 
51
51
  puts "Grok: #{matches[:grok] / groktime}"
52
+ puts matches.inspect
52
53
  puts failures.inspect
53
54
  #puts "rubyre: #{rubyretime}"
54
55
  #puts matches.inspect
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 3071
9
- version: 0.2.3071
8
+ - 3089
9
+ version: 0.2.3089
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jordan Sissel
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-10-17 00:00:00 -07:00
17
+ date: 2010-10-30 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies: []
20
20
 
@@ -42,6 +42,7 @@ files:
42
42
  - ext/ruby_grokmatch.o
43
43
  - test/general/basic_test.rb
44
44
  - test/general/captures_test.rb
45
+ - test/core
45
46
  - test/Makefile
46
47
  - test/alltests.rb
47
48
  - test/speedtest.rb
@@ -49,6 +50,7 @@ files:
49
50
  - test/patterns/day.rb
50
51
  - test/patterns/host.rb
51
52
  - test/patterns/number.rb
53
+ - test/patterns/iso8601.rb
52
54
  - test/patterns/ip.input
53
55
  - test/patterns/ip.rb
54
56
  - test/patterns/path.rb