Skip to content

[panw] sync with beats module#2758

Merged
efd6 merged 15 commits intoelastic:mainfrom
efd6:panw
Mar 8, 2022
Merged

[panw] sync with beats module#2758
efd6 merged 15 commits intoelastic:mainfrom
efd6:panw

Conversation

@efd6
Copy link
Copy Markdown
Contributor

@efd6 efd6 commented Mar 2, 2022

What does this PR do?

Checklist

  • I have reviewed tips for building integrations and this pull request is aligned with them.
  • I have verified that all data streams collect metrics or logs.
  • I have added an entry to my package's changelog.yml file.
  • I have verified that Kibana version constraints are current according to guidelines.

Author's Checklist

  • Note the apparent mantissa bit truncation of sequence_number. This is due to encoding/json remarshalling in elastic-package as can be seen with this reproducer https://play.golang.com/p/fkTBk9V_606.
  • Note error in case 7 of the GP tests that was broken in beat (will fix).

How to test this PR locally

Related issues

Screenshots

efd6 added 6 commits March 1, 2022 17:19
Note issue with sequence number in first test case.
minor change in 7th test case from the example in beats which appears to have been
broken in elastic/beats@c2befaf.

again note issue in bit truncation of mantissa in large-value sequence numbers.
@elasticmachine
Copy link
Copy Markdown

Pinging @elastic/security-external-integrations (Team:Security-External Integrations)

@elasticmachine
Copy link
Copy Markdown

elasticmachine commented Mar 2, 2022

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview [preview](https://ci-stats.elastic.co/app/apm/services/beats-ci/transactions/view?rangeFrom=2022-03-08T00:13:52.119Z&rangeTo=2022-03-08T00:33:52.119Z&transactionName=BUILD Ingest-manager/integrations/PR-{number}&transactionType=job&latencyAggregationType=avg&traceId=71ffde8dd0fb2bf3d2dd5fb786433dcb&transactionId=1f5887dd4bf4ad5e)

Expand to view the summary

Build stats

  • Start Time: 2022-03-08T00:23:52.119+0000

  • Duration: 18 min 53 sec

Test stats 🧪

Test Results
Failed 0
Passed 31
Skipped 0
Total 31

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

@efd6 efd6 requested a review from a team March 2, 2022 21:27
@andrewkroh andrewkroh changed the title panw: sync with beats module [panw] sync with beats module Mar 7, 2022
@andrewkroh
Copy link
Copy Markdown
Member

andrewkroh commented Mar 7, 2022

The Kibana constraint is 7.14.0 so CI is using that version. I assume the pipeline test data was generated on a newer stack version because it has a different time format. Something must have changed in the date processor because in 7.14.0 you get "@timestamp" : "2021-11-09T21:45:14.000Z and in newer versions (I only checked 8.0) you get "@timestamp" : "2021-11-09T16:45:14.000-05:00".

I noticed a typo in the manifest that's "UCT" instead of UTC.

And I think using America/New_York for tests will be problematic given that the offset changes with daylight savings. I think it would be safer to use a static offset like -05:00.

@andrewkroh
Copy link
Copy Markdown
Member

I think it would be good to add some pipeline tests that vary the value of _conf.tz_offset (like one where the value is not set and one where it is local). Each pipeline test can provide its own config instead of relying on test-common-config.yml.


# Set timezone, default to local.
- set:
field: event.timezone
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This adds a default which is good for keeping the logic in this pipeline safe, but I think this needs an override: false to prevent clobbering the event.timezone value added by Filebeat's add_locale. This way a configured tz_offset of local uses the Agent's local timezone.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

With this change I cannot test _conf.tz_offset: local. I will revert this.

value: "+0000"
- set:
field: event.timezone
value: "{{_conf.tz_offset}}"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
value: "{{_conf.tz_offset}}"
value: "{{{_conf.tz_offset}}}"

to prevent any HTML escaping being added by the mustache template engine in ES.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Does this also need to happen elsewhere with event.timezone (below).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I use the triple-brace version everywhere. I can't think of a use-case where I would want HTML escaping added.

And I try to avoid templates where possible. In the case of set it's usually better to use copy_from.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The specific place I'm thinking of is the date processor

  - date:
      field: "_temp_.generated_time"
      formats:
        - "yyyy/MM/dd HH:mm:ss"
        - "strict_date_optional_time_nanos"
      timezone: "{{ event.timezone }}" # HERE

# event.created is the time the event was received at the management plane.
- date:
if: "ctx?.event?.timezone != null && ctx?.event?.created != null "
if: "ctx?.event?.timezone != null && ctx?.event?.created != null"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Now that the pipeline adds a default event.timezone, can conditional for ctx?.event?.timezone != null be removed?

Copy link
Copy Markdown
Contributor Author

@efd6 efd6 Mar 8, 2022

Choose a reason for hiding this comment

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

🙂 Yes, I was leaving them in while this was decided. Also in two of the subpipelines.

@efd6 efd6 requested a review from andrewkroh March 8, 2022 00:59
@efd6 efd6 merged commit e016b1b into elastic:main Mar 8, 2022
@efd6 efd6 deleted the panw branch March 8, 2022 22:32
@jamiehynds
Copy link
Copy Markdown

@efd6 thanks for taking care of this one. Could we also ensure the PANW integration docs are updated to reflect support for GlobalProtect, User-ID and HIP Match events? https://github.com/elastic/integrations/tree/main/packages/panw/docs. Might be worth hyperlinking to the Palo docs for each category. e.g. GlobalProtect linking to here: https://docs.paloaltonetworks.com/pan-os/10-2/pan-os-admin/monitoring/use-syslog-for-monitoring/syslog-field-descriptions/globalprotect-log-fields.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

8.2-candidate enhancement New feature or request Integration:panw Palo Alto Next-Gen Firewall

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sync PANW integration with Beats module

5 participants