From: Justin Collins Date: 2013-06-26T09:41:01+09:00 Subject: Re: Issue in using Grok gem > Hi All, > > I wanted to parse a log file, so came across Grok. Installed the gem and > tried the below example that is given in the documentation below: > ---- > require 'grok' > > configure do |c| > c.file = "/var/log/auth.log" > c.interval = 2 > c.replay = 0 > end > ---- > When i run the above code, i get the following error: > ---- > C:\examples\code\grok>ruby parselog.rb > C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:45:in > `require': > C:/Ruby192/lib/ruby/gems/1.9.1/gems/grok-0.0.5/lib/grok/watcher.rb:121: > syntax > C:/Ruby192/lib/ruby/gems/1.9.1/gems/grok-0.0.5/lib/grok/watcher.rb:137: > syntax error, unexpected keyword_end, expecting $end > from > C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:45:in > `require' > from > C:/Ruby192/lib/ruby/gems/1.9.1/gems/grok-0.0.5/lib/grok.rb:1:in ` (required)>' > from :33:in `require' > from :33:in `rescue in > require' > from :29:in `require' > from parselog.rb:1:in `
' > ---- > What has gone wrong here? On 06/25/2013 11:14 AM, Rochit Sen wrote: > Hi All, > Any thoughts on above issue? > > thanks in advance. > If you look at the source code (https://github.com/rodjek/grok/blob/master/lib/grok/watcher.rb#L121) you will see that the syntax used is no longer valid in Ruby 1.9 (ending an if conditional with a colon). Since the code hasn't been touched in three years, I think you are looking at an outdated gem here. You may want to fork it and fix it up to be Ruby 1.9 compatible or open an issue on GitHub to poke the original author. -Justin