Blame tests/field_rfc5424timestamp-fmt_timestamp-unix.sh

Packit 1422b7
# added 2017-10-02 by Rainer Gerhards
Packit 1422b7
# This file is part of the liblognorm project, released under ASL 2.0
Packit 1422b7
Packit 1422b7
. $srcdir/exec.sh
Packit 1422b7
Packit 1422b7
test_def $0 "RFC5424 timestamp in timestamp-unix format"
Packit 1422b7
add_rule 'version=2'
Packit 1422b7
add_rule 'rule=:here is a timestamp %{ "type":"date-rfc5424", "name":"num", "format":"timestamp-unix"}% in RFC5424 format'
Packit 1422b7
execute 'here is a timestamp 2000-03-11T14:15:16+01:00 in RFC5424 format'
Packit 1422b7
assert_output_json_eq '{"num": 952780516}'
Packit 1422b7
Packit 1422b7
# with milliseconds (must be ignored with this format!)
Packit 1422b7
execute 'here is a timestamp 2000-03-11T14:15:16.321+01:00 in RFC5424 format'
Packit 1422b7
assert_output_json_eq '{"num": 952780516}'
Packit 1422b7
Packit 1422b7
#check cases where parsing failure must occur
Packit 1422b7
execute 'here is a timestamp 2000-03-11T14:15:16+01:00in RFC5424 format'
Packit 1422b7
assert_output_json_eq '{ "originalmsg": "here is a timestamp 2000-03-11T14:15:16+01:00in RFC5424 format", "unparsed-data": "2000-03-11T14:15:16+01:00in RFC5424 format" }'
Packit 1422b7
Packit 1422b7
Packit 1422b7
cleanup_tmp_files