File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ class GrokPatternNotFoundError < StandardError
1313 (?<pattern>[A-z0-9]+)
1414 (?::(?<subname>[@\[ \] A-z0-9_:.-]+?)
1515 (?::(?<type>(?:string|bool|integer|float|
16- time(?::.+)?|
16+ time(?::.+? )?|
1717 array(?::.)?)))?)?
1818 )
1919 \} /x
Original file line number Diff line number Diff line change @@ -359,6 +359,21 @@ class GrokParserTest < ::Test::Unit::TestCase
359359 assert_equal ( event_time ( "28/Feb/2013:12:00:00 +0900" , format : "%d/%b/%Y:%H:%M:%S %z" ) , time )
360360 end
361361 end
362+
363+ test "leading time type with following other type" do
364+ d = create_driver ( %[
365+ <grok>
366+ pattern \\ [%{HTTPDATE:log_timestamp:time:%d/%b/%Y:%H:%M:%S %z}\\ ] %{GREEDYDATA:message}
367+ </grok>
368+ ] )
369+ expected_record = {
370+ "log_timestamp" => event_time ( "03/Feb/2019:06:47:21 +0530" , format : "%d/%b/%Y:%H:%M:%S %z" ) ,
371+ "message" => "Python-urllib/2.7"
372+ }
373+ d . instance . parse ( '[03/Feb/2019:06:47:21 +0530] Python-urllib/2.7' ) do |time , record |
374+ assert_equal ( expected_record , record )
375+ end
376+ end
362377 end
363378
364379 private
You can’t perform that action at this time.
0 commit comments