Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/servicenow/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# newer versions go on top
- version: "1.3.2"
changes:
- description: Add explicit date parsing for the ECS '@timestamp' field.
type: bugfix
link: https://github.com/elastic/integrations/pull/16884
- version: "1.3.1"
changes:
- description: Fixed description for URL on the ServiceNow tables input.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"expected": [
{
"@timestamp": "2024-09-11 01:15:50",
"@timestamp": "2024-09-11T01:15:50.000-07:00",
"device": {
"model": {
"name": [
Expand Down Expand Up @@ -163,7 +163,7 @@
]
},
{
"@timestamp": "2015-07-06 11:59:27",
"@timestamp": "2015-07-06T11:59:27.000-07:00",
"ecs": {
"version": "8.17.0"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"expected": [
{
"@timestamp": "2024-09-10 08:15:50",
"@timestamp": "2024-09-10T08:15:50.000-07:00",
"ecs": {
"version": "8.17.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3339,6 +3339,41 @@ processors:
name: '{{ IngestPipeline "pipeline_task_ci" }}'
tag: pipeline_task_ci
if: ctx.servicenow?.event?.table_name == 'task_ci'
- date:
field: '@timestamp'
tag: date_timestamp
timezone: '{{{event.timezone}}}'
formats:
- yyyy-MM-dd H:mm:ss
- yyyy-MM-dd HH:mm:ss
- yyyy-MM-dd
- MM-dd-yyyy H:mm:ss
- MM-dd-yyyy HH:mm:ss
- MM-dd-yyyy
- dd-MM-yyyy H:mm:ss
- dd-MM-yyyy HH:mm:ss
- dd-MM-yyyy
- MM/dd/yyyy H:mm:ss
- MM/dd/yyyy HH:mm:ss
- MM/dd/yyyy
- dd/MM/yyyy H:mm:ss
- dd/MM/yyyy HH:mm:ss
- dd/MM/yyyy
- MM/dd/yy H:mm:ss
- MM/dd/yy HH:mm:ss
- MM/dd/yy
- dd.MM.yyyy H:mm:ss
- dd.MM.yyyy HH:mm:ss
- dd.MM.yyyy
- yyyy-MM-dd hh:mm:ss a
- ISO8601
Comment on lines +3347 to +3369
Copy link
Contributor

@ShourieG ShourieG Jan 8, 2026

Choose a reason for hiding this comment

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

My concern here is with formats like

  • MM-dd-yyyy
  • dd-MM-yyyy

as these are ambiguous from a global timestamp perspective. In india it's common trend to use dd-MM-yyyy or dd/MM/yyyy or dd.MM.yyyy. But in many places we use mm-dd-yyyy and etc.

How do we distinguish if the date 01-02-2026 or 05-07-2026 is in MM-dd-yyyy format or dd-MM-yyyy format ? Do we expect '@timestamp' to be normalised in any way ? If not how can we decide upon the right order of execution here ? If '@timestamp' is normalised as month-day-year, why have support for both patterns ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree. This is a LOCALE issue and should be configurable if it is necessary to handle different formats. Given that the servicenow data sources are essentially a free-for-all, we cannot safely determine which to use without being told by the user during configuration.

But in many places we use mm-dd-yyyy

Depending on the scope of "place"; this ordering is a US localisation.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The issue exists across the entire integration. All date processors currently support both MM-dd-yyyy and dd-MM-yyyy formats, while the preference is consistently set to MM-dd-yyyy across all processors.

I believe this is a separate concern, and we could open a new ticket to make the date format user-configurable instead of supporting multiple formats by default. Please let me know your thoughts, or if you think this should be addressed as part of the current PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's reasonable to use this given that the pattern is already widespread. We should fix this in a follow-up though since currently dd-MM-yyyy dates in the source data are being incorrectly parsed when dd is not greater than 12. The problem is that currently the effective default LOCALE is for the US format, so we would need to maintain that, and non-US formats would be required to turn on their LOCALE preference to ensure that timestamps are parsed when they are not in dd ≤ 12. This would be a breaking change, unless we make it relaxed rather than strict (we keep both orders, but the configuration changes the order of appearance in the formats list).

if: ctx.containsKey('@timestamp') && ctx['@timestamp'] != null
on_failure:
- remove:
field: '@timestamp'
- append:
field: error.message
value: 'Processor {{{_ingest.on_failure_processor_type}}} with tag {{{_ingest.on_failure_processor_tag}}} in pipeline {{{_ingest.on_failure_pipeline}}} failed with message: {{{_ingest.on_failure_message}}}'
- remove:
field:
- servicenow.event.asset.display_value
Expand Down
2 changes: 1 addition & 1 deletion packages/servicenow/manifest.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
format_version: 3.3.2
name: servicenow
title: "ServiceNow"
version: "1.3.1"
version: "1.3.2"
description: "Collect logs from ServiceNow with Elastic Agent."
type: integration
categories:
Expand Down