Hello,
I'm having a problem with getting my grok pattern to work within my filter. I've created a test.conf file to simplify and narrow down my problem and I cannot seem to get this to work. I have tried the syntax and examples that found in this forum and the docs with no success. I'm hoping someone can see what or where I am going wrong.
My objective is to parse a location string, represented in degrees minutes seconds, into their appropriate fields and later convert them to decimal degrees. But I am stumped on the first step of parsing out the degree minute second field, in their own fields.
Logstash version: 7.0.0
Tested grock pattern at: https://grokdebug.herokuapp.com/
The message being parsed:
313315.621N 0840411.775W
The grok pattern:
(?<lat_degree>\d{2})(?<lat_min>\d{2})(?<lat_sec>[0-9.]{6})(?<lat_dir>\w{1}) (?<lon_degree>\d{2})(?<lon_min>\d{2})(?<lon_sec>[0-9.]{7})(?<lon_dir>\w{1})
Config file:
input { stdin { } }
filter {
grok {
match => { "message", "%{\d{2}:lat_degree}%{\d{2}:lat_min}%{[0-9.]{6}:lat_sec}%{\w{1}:lat_dir} %{\d{3}:lon_degree}%{\d{2}:lon_min}%{[0-9.]{6}:lon_sec}%{\w{1}:lon_dir}" }
}
}
output {
stdout { codec => rubydebug }
}
The error message from logstaash command line
[dewee- config]$ logstash -f test.conf
Sending Logstash logs to /opt/logstash/logstash-current/logs which is now configured via log4j2.properties
[2019-04-29T08:00:34,511][WARN ][logstash.config.source.multilocal] Ignoring the 'pipelines.yml' file because modules or command line options are specified
[2019-04-29T08:00:34,527][INFO ][logstash.runner ] Starting Logstash {"logstash.version"=>"7.0.0"}
[2019-04-29T08:00:35,735][ERROR][logstash.agent ] Failed to execute action {:action=>LogStash::PipelineAction::Create/pipeline_id:main, :exception=>"LogStash::ConfigurationError", :message=>"Expected one of #, => at line 6, column 27 (byte 70) after filter {\n\n grok { \n match => { "message"", :backtrace=>["/opt/logstash/logstash-7.0.0/logstash-core/lib/logstash/compiler.rb:41:incompile_imperative'", "/opt/logstash/logstash-7.0.0/logstash-core/lib/logstash/compiler.rb:49:in
compile_graph'", "/opt/logstash/logstash-7.0.0/logstash-core/lib/logstash/compiler.rb:11:inblock in compile_sources'", "org/jruby/RubyArray.java:2577:in
map'", "/opt/logstash/logstash-7.0.0/logstash-core/lib/logstash/compiler.rb:10:incompile_sources'", "org/logstash/execution/AbstractPipelineExt.java:151:in
initialize'", "org/logstash/execution/JavaBasePipelineExt.java:47:ininitialize'", "/opt/logstash/logstash-7.0.0/logstash-core/lib/logstash/java_pipeline.rb:23:in
initialize'", "/opt/logstash/logstash-7.0.0/logstash-core/lib/logstash/pipeline_action/create.rb:36:inexecute'", "/opt/logstash/logstash-7.0.0/logstash-core/lib/logstash/agent.rb:325:in
block in converge_state'"]}
[2019-04-29T08:00:35,999][INFO ][logstash.agent ] Successfully started Logstash API endpoint {:port=>9600}
[2019-04-29T08:00:40,883][INFO ][logstash.runner ] Logstash shut down.