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

PANW incorrectly parse the timezone to UTC when Timezone in the event #13867

Closed
ph opened this issue Oct 1, 2019 · 5 comments · Fixed by #13926
Closed

PANW incorrectly parse the timezone to UTC when Timezone in the event #13867

ph opened this issue Oct 1, 2019 · 5 comments · Fixed by #13926
Assignees
Labels

Comments

@ph
Copy link
Contributor

ph commented Oct 1, 2019

I was involved in a user case concerning the PANW module and I have found out that the date doesn't seem to be correctly parsed by the ingest pipeline when the timezone is found in the event. I've changed the ingest pipeline for the following and it appears to have solved the user problem.

Is there something that I've missed or the pipeline is indeed incorrect?

diff --git a/x-pack/filebeat/module/panw/panos/ingest/pipeline.yml b/x-pack/filebeat/module/panw/panos/ingest/pipeline.yml
index 17ae7788d..887002a7f 100644
--- a/x-pack/filebeat/module/panw/panos/ingest/pipeline.yml
+++ b/x-pack/filebeat/module/panw/panos/ingest/pipeline.yml
@@ -6,48 +6,50 @@ processors:
      field: message
      target_field: log.original
 
-# Set @timestamp to the time when the entry was generated at the data plane.
  - date:
+     if: "ctx.event.timezone == null"
      field: "_temp_.generated_time"
      ignore_failure: true
      formats:
        - "yyyy/MM/dd HH:mm:ss"
  - date:
-    if: "ctx.event.timezone != null"
-    field: "@timestamp"
-    formats: ["ISO8601"]
-    timezone: "{{ event.timezone }}"
-    on_failure: [{"append": {"field": "error.message", "value": "{{ _ingest.on_failure_message }}"}}]
+     if: "ctx.event.timezone != null"
+     field: "_temp_.generated_time"
+     formats: ["yyyy/MM/dd HH:mm:ss"]
+     timezone: "{{ event.timezone }}"
+     on_failure: [{"append": {"field": "error.message", "value": "{{ _ingest.on_failure_message }}"}}]
 
 # event.created is the time the event was received at the management plane.
  - date:

+     if: "ctx.event_timezone == null"
      field: "event.created"
      target_field: "event.created"
      ignore_failure: true
      formats:
        - "yyyy/MM/dd HH:mm:ss"
  - date:
-    if: "ctx.event.timezone != null && ctx.event.created != null "
-    field: "event.created"
-    target_field: "event.created"
-    formats: ["ISO8601"]
-    timezone: "{{ event.timezone }}"
-    on_failure: [{"append": {"field": "error.message", "value": "{{ _ingest.on_failure_message }}"}}]
+     if: "ctx.event.timezone != null && ctx.event.created != null "
+     field: "event.created"
+     target_field: "event.created"
+     formats: ["yyyy/MM/dd HH:mm:ss"]
+     timezone: "{{ event.timezone }}"
+     on_failure: [{"append": {"field": "error.message", "value": "{{ _ingest.on_failure_message }}"}}]
 
 # event.start (traffic only) is the time the session started.
  - date:
+     if: "ctx.event.timezone == null"
      field: "event.start"
      target_field: "event.start"
      ignore_failure: true
      formats:
        - "yyyy/MM/dd HH:mm:ss"
  - date:
-    if: "ctx.event.timezone != null && ctx.event.start != null"
-    field: "event.start"
-    target_field: "event.start"
-    formats: ["ISO8601"]
-    timezone: "{{ event.timezone }}"
-    on_failure: [{"append": {"field": "error.message", "value": "{{ _ingest.on_failure_message }}"}}]
+     if: "ctx.event.timezone != null && ctx.event.start != null"
+     field: "event.start"
+     target_field: "event.start"
+     formats: ["yyyy/MM/dd HH:mm:ss"]
+     timezone: "{{ event.timezone }}"
+     on_failure: [{"append": {"field": "error.message", "value": "{{ _ingest.on_failure_message }}"}}]
 
 # convert integer fields as the output of the CSV processor is always a string.
  - convert: { type: long, ignore_missing: true, field: client.bytes }
@ph ph added the module label Oct 1, 2019
@ph
Copy link
Contributor Author

ph commented Oct 1, 2019

Maybe @elastic/observability could comment on that?

@jsoriano
Copy link
Member

jsoriano commented Oct 2, 2019

I am also investigating these issues, I have opened a PR to avoid using UTC in pipelines testing, so we better see if changes in pipelines incorrectly change the resulting events (#13874).

This way I have found that there are some other incorrect modules.

The fix would be the one you posted here yes, @ph would you want to open a PR with this fix for this module? I will take care of others I have found.

@jsoriano
Copy link
Member

jsoriano commented Oct 2, 2019

I have created #13877 to keep track of this issue in affected modules.

@ph
Copy link
Contributor Author

ph commented Oct 2, 2019

@jsoriano can you take it over, so only one review is necessary ?:)

@jsoriano
Copy link
Member

jsoriano commented Oct 2, 2019

@ph ok, I will take it as part of #13877 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants