Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Automatic Import] add timestamp to ECS constants #204931

Merged
merged 6 commits into from
Dec 27, 2024

Conversation

haetamoudi
Copy link
Contributor

@haetamoudi haetamoudi commented Dec 19, 2024

Release Note

Automatic Import now ensures that the field mapping contains the @timestamp field whenever possible.

Summary

Ensure mapping contains @timestamp field whenever possible. #196040

Tested cases:

test case has @timestamp is expected result
sample logs with datetime value for time and expires fields yes (picked time as @timestamp)
sample logs with datetime value for expires field only no
sample logs with no datetime values no
sample logs with created_at field that does not contain datetime value no

Tested values for time field:

value match correctly @timestamp
2024-02-24T06:56:50.648137154Z
10/01/2023 12:34:56
01-10-2023 12:34:56
Thu, 25 December 2023 10:15:00GMT

Checklist

  • Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support
  • Documentation was added for features that require explanation or tutorials
  • Unit or functional tests were updated or added to match the most common scenarios
  • If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the docker list
  • This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The release_note:breaking label should be applied in these situations.
  • Flaky Test Runner was used on any tests changed
  • The PR description includes the appropriate Release Notes section, and the correct release_note:* label is applied per the guidelines

@haetamoudi haetamoudi added release_note:skip Skip the PR/issue when compiling release notes backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) Team:Security-Scalability Team label for Security Integrations Scalability Team Feature:AutomaticImport labels Dec 19, 2024
@haetamoudi haetamoudi requested a review from a team as a code owner December 19, 2024 12:28
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-scalability (Team:Security-Scalability)

@ebeahan
Copy link
Member

ebeahan commented Dec 19, 2024

Ensure mapping contains @timestamp field whenever possible

For ECS events, @timestamp is a required field. If the provided log samples are missing an obvious field to use for @timestamp or the model doesn't map a field for whatever reason, maybe the produced pipeline should follow the ECS guidance?

If the event source has no original timestamp, this value is typically populated by the first time the event was received by the pipeline.

@ilyannn
Copy link
Contributor

ilyannn commented Dec 19, 2024

Ensure mapping contains @timestamp field whenever possible

For ECS events, @timestamp is a required field. If the provided log samples are missing an obvious field to use for @timestamp or the model doesn't map a field for whatever reason, maybe the produced pipeline should follow the ECS guidance?

If the event source has no original timestamp, this value is typically populated by the first time the event was received by the pipeline.

We could add a processor at the end of all the ingest pipelines that fills out the @timestamp with the current date. That would seem to satisfy the guidance in the fullest possible way.

Copy link
Contributor

@ilyannn ilyannn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. We can iterate in terms of further testing to see if we need to give more examples or think through the fallback.

@ebeahan
Copy link
Member

ebeahan commented Dec 20, 2024

This looks good to me. We can iterate in terms of further testing to see if we need to give more examples or think through the fallback.

++ I don't want to sidetrack getting the improvements in ASAP, so we can continue the discussion beyond this PR (I'll open an issue 😄 ).

@ilyannn ilyannn enabled auto-merge (squash) December 27, 2024 15:56
@ilyannn ilyannn added release_note:fix and removed release_note:skip Skip the PR/issue when compiling release notes labels Dec 27, 2024
@ilyannn ilyannn merged commit 4cc6952 into elastic:main Dec 27, 2024
11 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

https://github.com/elastic/kibana/actions/runs/12518847786

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Dec 27, 2024
## Summary

Ensure mapping contains `@timestamp` field whenever possible.
elastic#196040

Tested cases:
| test case | has `@timestamp` | is expected result |
|---|---|---|
| sample logs with datetime value for `time` and `expires` fields | yes
(picked `time` as `@timestamp`) | ✅ |
| sample logs with datetime value for `expires` field only | no | ✅ |
| sample logs with no datetime values | no | ✅ |
| sample logs with `created_at` field that does not contain datetime
value | no | ✅ |

Tested values for `time` field:

| value  | match correctly `@timestamp` |
|---|---|
| `2024-02-24T06:56:50.648137154Z` | ✅ |
| `10/01/2023 12:34:56`  | ✅ |
| `01-10-2023 12:34:56` | ✅ |
| `Thu, 25 December 2023 10:15:00GMT` | ✅

---------

Co-authored-by: kibanamachine <[email protected]>
Co-authored-by: Ilya Nikokoshev <[email protected]>
(cherry picked from commit 4cc6952)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Dec 27, 2024
…05216)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Automatic Import] add timestamp to ECS constants
(#204931)](#204931)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Hanna
Tamoudi","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-12-27T17:24:02Z","message":"[Automatic
Import] add timestamp to ECS constants (#204931)\n\n##
Summary\r\n\r\nEnsure mapping contains `@timestamp` field whenever
possible.\r\nhttps://github.com//issues/196040\r\n\r\nTested
cases:\r\n| test case | has `@timestamp` | is expected result
|\r\n|---|---|---|\r\n| sample logs with datetime value for `time` and
`expires` fields | yes\r\n(picked `time` as `@timestamp`) | ✅ |\r\n|
sample logs with datetime value for `expires` field only | no | ✅ |\r\n|
sample logs with no datetime values | no | ✅ |\r\n| sample logs with
`created_at` field that does not contain datetime\r\nvalue | no | ✅
|\r\n\r\n\r\nTested values for `time` field:\r\n\r\n| value | match
correctly `@timestamp` |\r\n|---|---|\r\n|
`2024-02-24T06:56:50.648137154Z` | ✅ |\r\n| `10/01/2023 12:34:56` | ✅
|\r\n| `01-10-2023 12:34:56` | ✅ |\r\n| `Thu, 25 December 2023
10:15:00GMT` | ✅ \r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<[email protected]>\r\nCo-authored-by:
Ilya Nikokoshev
<[email protected]>","sha":"4cc6952c83de1bd7eacd95c458bbe6c281b364b0","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","v9.0.0","backport:prev-minor","Team:Security-Scalability","Feature:AutomaticImport"],"title":"[Automatic
Import] add timestamp to ECS
constants","number":204931,"url":"https://github.com/elastic/kibana/pull/204931","mergeCommit":{"message":"[Automatic
Import] add timestamp to ECS constants (#204931)\n\n##
Summary\r\n\r\nEnsure mapping contains `@timestamp` field whenever
possible.\r\nhttps://github.com//issues/196040\r\n\r\nTested
cases:\r\n| test case | has `@timestamp` | is expected result
|\r\n|---|---|---|\r\n| sample logs with datetime value for `time` and
`expires` fields | yes\r\n(picked `time` as `@timestamp`) | ✅ |\r\n|
sample logs with datetime value for `expires` field only | no | ✅ |\r\n|
sample logs with no datetime values | no | ✅ |\r\n| sample logs with
`created_at` field that does not contain datetime\r\nvalue | no | ✅
|\r\n\r\n\r\nTested values for `time` field:\r\n\r\n| value | match
correctly `@timestamp` |\r\n|---|---|\r\n|
`2024-02-24T06:56:50.648137154Z` | ✅ |\r\n| `10/01/2023 12:34:56` | ✅
|\r\n| `01-10-2023 12:34:56` | ✅ |\r\n| `Thu, 25 December 2023
10:15:00GMT` | ✅ \r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<[email protected]>\r\nCo-authored-by:
Ilya Nikokoshev
<[email protected]>","sha":"4cc6952c83de1bd7eacd95c458bbe6c281b364b0"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/204931","number":204931,"mergeCommit":{"message":"[Automatic
Import] add timestamp to ECS constants (#204931)\n\n##
Summary\r\n\r\nEnsure mapping contains `@timestamp` field whenever
possible.\r\nhttps://github.com//issues/196040\r\n\r\nTested
cases:\r\n| test case | has `@timestamp` | is expected result
|\r\n|---|---|---|\r\n| sample logs with datetime value for `time` and
`expires` fields | yes\r\n(picked `time` as `@timestamp`) | ✅ |\r\n|
sample logs with datetime value for `expires` field only | no | ✅ |\r\n|
sample logs with no datetime values | no | ✅ |\r\n| sample logs with
`created_at` field that does not contain datetime\r\nvalue | no | ✅
|\r\n\r\n\r\nTested values for `time` field:\r\n\r\n| value | match
correctly `@timestamp` |\r\n|---|---|\r\n|
`2024-02-24T06:56:50.648137154Z` | ✅ |\r\n| `10/01/2023 12:34:56` | ✅
|\r\n| `01-10-2023 12:34:56` | ✅ |\r\n| `Thu, 25 December 2023
10:15:00GMT` | ✅ \r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<[email protected]>\r\nCo-authored-by:
Ilya Nikokoshev
<[email protected]>","sha":"4cc6952c83de1bd7eacd95c458bbe6c281b364b0"}}]}]
BACKPORT-->

Co-authored-by: Hanna Tamoudi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) Feature:AutomaticImport release_note:fix Team:Security-Scalability Team label for Security Integrations Scalability Team v8.18.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants