Skip to content

Commit

Permalink
Match timestamps without year in pipeline tests with regex (#4984)
Browse files Browse the repository at this point in the history
- Timestamps that are parsed without a year (such as those on BSD-style
syslog messages) will have their expected values inherit the year the
expected files are generated in. This means that tests will only pass
in the year that the expected files are generated.
- The relevant timestamp field (@timestamp, for example) has been added
to the pipeline test config as a dynamic field, and a regex pattern is
used to match the expected format of the timestamp.
  • Loading branch information
taylor-swanson authored Jan 13, 2023
1 parent 546ab70 commit 1b81b78
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
dynamic_fields:
"@timestamp": "^[0-9]{4}(-[0-9]{2}){2}T[0-9]{2}(:[0-9]{2}){2}\\.[0-9]{3}"
fields:
tags:
- preserve_original_event
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
dynamic_fields:
"@timestamp": "^[0-9]{4}(-[0-9]{2}){2}T[0-9]{2}(:[0-9]{2}){2}\\.[0-9]{3}"
fields:
tags:
- preserve_original_event
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
dynamic_fields:
event.ingested: ".*"
"@timestamp": "^[0-9]{4}(-[0-9]{2}){2}T[0-9]{2}(:[0-9]{2}){2}\\.[0-9]{3}"
fields:
tags:
- preserve_original_event
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
dynamic_fields:
"@timestamp": "^[0-9]{4}(-[0-9]{2}){2}T[0-9]{2}(:[0-9]{2}){2}\\.[0-9]{3}"
fields:
tags:
- preserve_original_event
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
dynamic_fields:
"@timestamp": "^[0-9]{4}(-[0-9]{2}){2}T[0-9]{2}(:[0-9]{2}){2}\\.[0-9]{3}"
fields:
tags:
- preserve_original_event
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
dynamic_fields:
"event.created": "^[0-9]{4}(-[0-9]{2}){2}T[0-9]{2}(:[0-9]{2}){2}\\.[0-9]{3}"
"@timestamp": "^[0-9]{4}(-[0-9]{2}){2}T[0-9]{2}(:[0-9]{2}){2}\\.[0-9]{3}"
fields:
tags:
- preserve_original_event
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
dynamic_fields:
"@timestamp": "^[0-9]{4}(-[0-9]{2}){2}T[0-9]{2}(:[0-9]{2}){2}\\.[0-9]{3}"
fields:
tags:
- preserve_original_event
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
dynamic_fields:
"@timestamp": "^[0-9]{4}(-[0-9]{2}){2}T[0-9]{2}(:[0-9]{2}){2}\\.[0-9]{3}"
fields:
tags:
- forwarded
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
dynamic_fields:
"@timestamp": "^[0-9]{4}(-[0-9]{2}){2}T[0-9]{2}(:[0-9]{2}){2}\\.[0-9]{3}"
fields:
tags:
- preserve_original_event

0 comments on commit 1b81b78

Please sign in to comment.