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

Cherry-pick #22481 to 7.x: [filebeat][panw] Improve panos fileset url parsing #22670

Merged
merged 1 commit into from
Nov 19, 2020
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,7 @@ from being added to events by default. {pull}18159[18159]
- Added DNS response IP addresses to `related.ip` in Suricata module. {pull}22291[22291]
- Added TLS JA3 fingerprint, certificate not_before/not_after, certificate SHA1 hash, and certificate subject fields to Zeek SSL dataset. {pull}21696[21696]
- Added `event.ingested` field to data from the Netflow module. {pull}22412[22412]
- Improve panw ECS url fields mapping. {pull}22481[22481]

*Heartbeat*

Expand Down
53 changes: 53 additions & 0 deletions x-pack/filebeat/module/panw/panos/ingest/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,47 @@ processors:
value: "{{panw.panos.ruleset}}"
ignore_empty_value: true

# Set url and file values
- rename:
if: 'ctx?.panw?.panos?.sub_type != "url"'
field: url.original
target_field: file.name
ignore_missing: true

- grok:
field: url.original
patterns:
- '(%{ANY:url.scheme}\:\/\/)?(%{USERNAME:url.username}(\:%{PASSWORD:url.password})?\@)?%{DOMAIN:url.domain}(\:%{POSINT:url.port})?(%{PATH:url.path})?(\?%{QUERY:url.query})?(\#%{ANY:url.fragment})?'
ignore_missing: true
pattern_definitions:
USERNAME: '[^\:]*'
PASSWORD: '[^@]*'
DOMAIN: '[^\/\?#\:]*'
PATH: '[^\?#]*'
QUERY: '[^#]*'
ANY: '.*'
if: 'ctx?.url?.original != null && ctx?.url?.original != "-/" && ctx?.url?.original != ""'

- grok:
field: url.path
patterns:
- '%{FILENAME}((?:\.%{ANY})*(\.%{ANY:url.extension}))?'
ignore_missing: true
pattern_definitions:
FILENAME: '[^\.]+'
ANY: '.*'
if: 'ctx?.url?.path != null && ctx?.url?.path != ""'

- grok:
field: file.name
patterns:
- '%{FILENAME}((?:\.%{ANY})*(\.%{ANY:file.extension}))?'
ignore_missing: true
pattern_definitions:
FILENAME: '[^\.]+'
ANY: '.*'
if: 'ctx?.file?.name != null && ctx?.file?.name != ""'

- append:
field: related.user
value: "{{client.user.name}}"
Expand All @@ -467,6 +508,12 @@ processors:
value: "{{destination.user.name}}"
if: "ctx?.destination?.user?.name != null"

- append:
field: related.user
value: "{{url.username}}"
if: "ctx?.url?.username != null && ctx?.url?.username != ''"
allow_duplicates: false

- append:
field: related.hash
value: "{{panw.panos.file.hash}}"
Expand All @@ -478,6 +525,12 @@ processors:
if: "ctx?.observer?.hostname != null && ctx.observer?.hostname != ''"
allow_duplicates: false

- append:
field: related.hosts
value: "{{url.domain}}"
if: "ctx?.url?.domain != null && ctx.url?.domain != ''"
allow_duplicates: false

# Remove temporary fields.
- remove:
field:
Expand Down
Loading