Skip to content

Conversation

@vinit-chauhan
Copy link
Contributor

@vinit-chauhan vinit-chauhan commented Jun 17, 2022

What does this PR do?

This PR is adding support of PAN-OS 10 to existing panw integration.

Added support for new log types. (Authentication, Config, Correlated Event logs, Decryption logs, GTP, IP tag, SCTP, System, Tunnel Inspection).
Added toggle to remove duplicate custom fields for ECS mapped field.
Mapped fields according to the ECS schema and added Fields metadata in the appropriate yml files.
Added a new set of inbuilt dashboards and visualizations.
Added test for pipeline for the data stream.
Added system test cases for the data stream.

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

  • [ ]

How to test this PR locally

Clone integrations repo.
Install elastic-package locally.
Start elastic stack using elastic-package.
Move to integrations/packages/panw directory.
Run the following command to run tests.
elastic-package test

Related issues

Fixed following issues in current integration.

  • Changed the type of "panw.panos.sequence_number" to a keyword to avoid wrong sequence number.
  • The field "panw.panos.high_resolution_timestamp" shows value different from original event.
  • User-agent related fields are not extracted from the user-agent string.
  • Incorrect Field type in "panw.panos.response_time" field

Known Issues

  • For some events, "destination.geo.name" is mapped to a wrong value and contains an IP subnet mask as its value.
  • Field "url.original" is not processed correctly as uri_parts processor is not used.
  • for threat events, there are visualizations containing client.ip and source.ip however these fields are not mapped in the pipeline.

Screenshots

image

@vinit-chauhan vinit-chauhan requested a review from a team as a code owner June 17, 2022 14:53
@vinit-chauhan vinit-chauhan added enhancement New feature or request Team:Security-External Integrations Integration:panw Palo Alto Next-Gen Firewall labels Jun 17, 2022
@elasticmachine
Copy link

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

@vinit-chauhan vinit-chauhan self-assigned this Jun 17, 2022
@elasticmachine
Copy link

elasticmachine commented Jun 17, 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

Expand to view the summary

Build stats

  • Start Time: 2022-07-19T20:57:20.834+0000

  • Duration: 20 min 5 sec

Test stats 🧪

Test Results
Failed 0
Passed 51
Skipped 0
Total 51

🤖 GitHub comments

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

  • /test : Re-trigger the build.
@elasticmachine
Copy link

elasticmachine commented Jun 17, 2022

🌐 Coverage report

Name Metrics % (covered/total) Diff
Packages 100.0% (1/1) 💚
Files 100.0% (15/15) 💚 3.036
Classes 100.0% (15/15) 💚 3.036
Methods 98.529% (67/68) 👍 9.424
Lines 94.925% (3180/3350) 👍 4.566
Conditionals 100.0% (0/0) 💚
Comment on lines 83 to 90
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason not to do these in the csv processor?

Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason to duplicate the ECS fields into the PanOS fields? Is it to explicitly show the provenance of the ECS fields. If that's the case, maybe reverse the assignments (csv into the panos fields and copy into the ecs).

Copy link
Contributor

Choose a reason for hiding this comment

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

Reverse these so panw.panos.host.ip and panw.panos.device_name are set in the csv.

Copy link
Contributor

Choose a reason for hiding this comment

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

Add description.

Copy link
Contributor

Choose a reason for hiding this comment

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

Add description.

Copy link
Contributor

Choose a reason for hiding this comment

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

Add description.

Copy link
Contributor

Choose a reason for hiding this comment

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

Add description.

Copy link
Contributor

Choose a reason for hiding this comment

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

Add description.

@vinit-chauhan vinit-chauhan force-pushed the package_panw_connect branch from b0aa709 to 1820d56 Compare June 20, 2022 11:41
@vinit-chauhan vinit-chauhan force-pushed the package_panw_connect branch from 1820d56 to 976e3a9 Compare June 20, 2022 11:43
- convert:
field: source.ip
type: ip
ignore_failure: true
Copy link
Member

Choose a reason for hiding this comment

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

With this configuration, the processor does nothing. source.ip is already a string and after "conversion" to type: ip it will still be a string. The reason convert has a type: ip is to perform validation. On failure that validation can result it the value not being copied to target_field or it can result in the execution of an on_failure handler. But this has neither of those.

So I think in this case I think you want to remove ignore_failure, add an on_failure handler to remove the invalid field, and add ignore_missing: true.

- convert:
field: panw.panos.source.port
type: long
ignore_failure: true
Copy link
Member

@andrewkroh andrewkroh Jul 7, 2022

Choose a reason for hiding this comment

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

Assuming the mapping type is a long, then leaving the bad field value present by ignore_failure: true will result in an event that cannot be indexed (the only exception is if the value is a null). IMO it's better to deal with those issues in the pipeline than let an event pass through that will fail to index. My suggestion is to remove the field with an on_failure, or if you don't want a silent failure you can remove the field and append an error.message.

# Add '-' in Mac Address and convert it into uppercase
- gsub:
field: panw.panos.src.mac
pattern: '[-:.]'
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
pattern: '[-:.]'
pattern: '[:.]'
if: 'ctx?.destination?.nat?.ip == "0.0.0.0" && ctx?.destination?.nat?.port == 0'
if: 'ctx.destination?.nat?.ip == "0.0.0.0" && ctx.destination?.nat?.port == 0'

#Remove custom fields
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
#Remove custom fields
# Remove panw.panos fields that are copied into an ECS field.
ignore_failure: true
source: |
Map map = new HashMap();
map.put("add", "cmd-add");
Copy link
Member

Choose a reason for hiding this comment

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

This data should be put into params so this a new map does not need to be allocated on every invocation of the processor. Data can be accessed through params.get(key) or params[key] in the script.

- script: params: add: cmd-add clone: cmd-clone ... 
@@ -0,0 +1,685 @@
{
Copy link
Member

Choose a reason for hiding this comment

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

Please unlink the dashboards to embed any visualizations that are not shared across dashboards.

@vinit-chauhan
Copy link
Contributor Author

Hey @andrewkroh,
The changes you suggested above regarding ignore_failure make sense to me. We will update all the convert processors to add an error message and remove the field in the on_failure section. As the convert processor is used in multiple places we have to throughly test the pipeline. So we will make the changes and update the PR later next week.

@LaZyDK
Copy link
Contributor

LaZyDK commented Jul 8, 2022

I am testing with real live data. All but THREAT seems to work great.
The CSV processor in THREAT do not like this (anonymized) event. Getting error in Threat pipeline: error in [csv] processor Unmatched quote

1,2022/07/08 13:36:36,013201000516,THREAT,file,2561,2022/07/08 13:36:36,10.0.0.1,80.1.2.3,30.1.2.3,80.1.2.3,Internet Administration,domain\user,,youtube-streaming,vsys1,Admin,Internet,ae1.1701,ae3.70,default,2022/07/08 13:36:36,50003,1,58116,443,34299,443,0x1402000,tcp,alert,"videoplayback",Unknown Binary File(52081),streaming-media,low,server-to-client,7093208347630664272,0x8000000000000000,Administrator Network,Denmark,,,0,,"rr2---sn-uqj-j2ik.googlevideo.com/videoplayback?expire=1657301059&ei=4xPIYsejLdaE0u8PisaH-As&ip=30.1.2.3&id=o-AFv-xEKlSerh7KLAqQpIv7lqMuInG7abjfsgIuxl43kC&itag=251&source=youtube&requiressl=yes&mh=1d&mm=31,29&mn=sn-uqj-j2ik,sn-5go7yner&ms=au,rdu&mv=m&mvi=2&pcm2cms=yes&pl=22&initcwndbps=2217500&spc=lT-KhsRY8qwGmkHJVEsoVP6X2T8w1I4&vprv=1&mime=audio/webm&ns=QWxF_PhMKjieFOZmr32qEI4H&gir=yes&clen=72710742&dur=4558.041&lmt=1652802983091490&mt=1657279033&fvip=5&keepalive=yes&fexp=24001373,24007246&c=WEB&txp=5532434&n=h1nHe02SxuOjBA&sparams=expire,ei,ip,id,itag,source,requiressl,spc,vprv,mime,ns,gir,clen,dur,lmt&lsparams=mh,mm,mn,ms,mv,mvi,pcm2cms,pl,initcwndbps&lsig=AG3C_xAwRQIhAKiVIJi9FDmP7Fw1JKSAPs1R1-WkWzGCATwD8a_yAJbuAiBa0t4gha0PIfRw-U_IKoO_SlD9I6w8pKzK6Rnv0JyZZw==&alr=yes&sig=AOq0QJ8wRQIhAMSKgcjdFEjwtwVkVLdl0vLDlBuO7URWNcYxmb3uOYN8AiAPFNzsX7xi7GGoDxNSQ3jE8q3zI7SIcmSq3kBFY43kGA==&cpn=qcO0_bbtu_nw5kSS&cver=2.20220706.08.00&range=13360464-13827425&rn=275&rbuf=114997&pot=GpsBCm43A3uL5J5mdnP2Aqcg7x0XsBLorTKV_hQdn",109,,,"rr2---sn-uqj-j2ik.googlevideo.com/videoplayback?expire=1657301059&ei=4xPIYsejLdaE0u8PisaH-As&ip=30.1.2.3&id=o-AFv-xEKlSerh7KLAqQpIv7lqMuInG7abjfsgIuxl43kC&itag=251&source=youtube&requiressl=yes&mh=1d&mm=31,29&mn=sn-uqj-j2ik,sn-5go7yner&ms=au,rdu&mv=m&mvi=2&pcm2cms=yes&pl=22&initcwndbps=2217500&spc=lT-KhsRY8qwGmkHJVEsoVP6X2T8w1I4&vprv=1&mime=audio/webm&ns=QWxF_PhMKjieFOZmr32qEI4H&gir=yes&clen=72710742&dur=4558.041&lmt=1652802983091490&mt=1657279033&fvip=5&keepalive=yes&fexp=24001373,24007246&c=WEB&txp=5532434&n=h1nHe02SxuOjBA&sparams=expire,ei,ip,id,itag,source,requiressl,spc,vprv,mime,ns,gir,clen,dur,lmt&lsparams=mh,mm,mn,ms,mv,mvi,pcm2cms,pl,initcwndbps&lsig=AG3C_xAwRQIhAKiVIJi9FDmP7Fw1JKSAPs1R1-WkWzGCATwD8a_yAJbuAiBa0t4gha0PIfRw-U_IKoO_SlD9I6w8pKzK6Rnv0JyZZw==&alr=yes&sig=AOq0QJ8wRQIhAMSKgcjdFEjwtwVkVLdl0vLDlBuO7URWNcYxmb3uOYN8AiAPFNzsX7xi7GGoDxNSQ3jE8q3zI7SIcmSq3kBFY43kGA==&cpn=qcO0_bbtu_nw5kSS&cver=2.20220706.08.00&range=13360464-13827425&rn=275&rbuf=114997&pot=GpsBCm43A3uL5J5mdnP2Aqcg7x0XsBLorTKV_hQdn","rr2---sn-uqj-j2ik.googlevideo.com/videoplayback?expire=1657301059&ei=4xPIYsejLdaE0u8PisaH-As&ip=30.1.2.3&id=o-AFv-xEKlSerh7KLAqQpIv7lqMuInG7abjfsgIuxl43kC&itag=251&source=youtube&requiressl=yes&mh=1d&mm=31,29&mn=sn-uqj-j2ik,sn-5go7yner&ms=au,rdu&mv=m&mvi=2&pcm2cms=yes&pl=22&initcwndbps=2217500&spc=lT-KhsRY8qwGmkHJVEsoVP6X2T8w1I4&vprv=1&mime=audio/webm&ns=QWxF_PhMKjieFOZmr32qEI4H&gir=yes&clen=72710742&dur=4558.041&lmt=1652802983091490&mt=1657279033&fvip=5&keepalive=yes&fexp=24001373,24007246&c=WEB&txp=5532434&n=h1nHe02SxuOjBA&sparams=expire,ei,ip,id,itag,source,requiressl,spc,vprv,mime,ns,gir,clen,dur,lmt&lsparams=mh,mm,mn,ms,mv,mvi,pcm2cms,pl,initcwndbps&lsig=AG3C_xAwRQIhAKiVIJi9FDmP7Fw1JKSAPs1R1-WkWzGCATwD8a_yAJbuAiBa0t4gha0PIfRw-U_IKoO_SlD9I6w8pKzK6Rnv0JyZZw==&alr=yes&sig=AOq0QJ8wRQIhAMSKgcjdFEjwtwVkVLdl0vLDlBuO7URWNcYxmb3uOYN8AiAPFNzsX7xi7GGoDxNSQ3jE8q3zI7SIcmSq3kBFY43kGA==&cpn=qcO0_bbtu_nw5kSS&cver=2.20220706.08.00&range=13360464-13827425&rn=275&rbuf=114997&pot=GpsBCm43A3uL5J5mdnP2Aqcg7x0XsBLorTKV_hQdn","rr2---sn-uqj-j2ik.googlevideo.com/videoplayback?expire=1657301059&ei=4xPIYsejLdaE0u8PisaH-As&ip=30.1.2.3&id=o-AFv-xEKlSerh7KLAqQpIv7lqMuInG7abjfsgIuxl43kC&itag=251&source=youtube&requiressl=yes&mh=1d&mm=31,29&mn=sn-uqj-j2ik,sn-5go7yner&ms=au,rdu&mv=m&mvi=2&pcm2cms=yes&pl=22&initcwndbps=2217500&spc=lT-KhsRY8qwGmkHJVEsoVP6X2T8w1I4&vprv=1&mime=audio/webm&ns=QWxF_PhMKjieFOZmr32qEI4H&gir=yes&clen=72710742&dur=4558.041&lmt=1652802983091490&mt=1657279033&fvip=5&keepalive=yes&fexp=24001373,24007246&c=WEB&txp=5532434&n=h1nHe02SxuOjBA&sparams=expire,ei,ip,id,itag,source,requiressl,spc,vprv,mime,ns,gir,clen,dur,lmt&lsparams=mh,mm,mn,ms,mv,mvi,pcm2cms,pl,initcwndbps&lsig=AG3C_xAwRQIhAKiVIJi9FDmP7Fw1JKSAPs1R1-WkWzGCATwD8a_yAJbuAiBa0t4gha0PIfRw-U_IKoO_SlD9I6w8pKzK6Rnv0JyZZw==&alr=yes&sig=AOq0QJ8wRQIhAMSKgcjdFEjwtwVkVLdl0vLDlBuO7URWNcYxmb3uOYN8AiAPFNzsX7xi7GGoDxNSQ3jE8q3zI7SIcmSq3kBFY43kGA==&cpn=qcO0_bbtu_nw5kSS&cver=2.20220706.08.00&range=13360464-13827425&rn=275&rbuf=114997&pot=GpsBCm43A3uL5J5mdnP2Aqcg7x0XsBLorTKV_hQdn","rr2---sn-uqj-j2ik.googlevideo.com/videoplayback?expire=1657301059&ei=4xPIYsejLdaE0u8PisaH-As&ip=30.1.2.3&id=o-AFv-xEKlSerh7KLAqQpIv7lqMuInG7abjfsgIuxl43kC&itag=251&source=youtube&requiressl=yes&mh=1d&mm=31,29&mn=sn-uqj-j2ik,sn-5go7yner&ms=au,rdu&mv=m&mvi=2&pcm2cms=yes&pl=22&initcwndbps=2217500&spc=lT-KhsRY8qwGmkHJVEsoVP6X2T8w1I4&vprv=1&mime=audio/webm&ns=QWxF_PhMKjieFOZmr32qEI4H&gir=yes&clen=72710742&dur=4558.041&lmt=1652802983091490&mt=1657279033&fvip=5&keepalive=yes&fexp=24001373,24007246&c=WEB&txp=5532434&n=h1nHe02SxuOjBA&sparams=expire,ei,ip,id,itag,source,requiressl,spc,vprv,mime,ns,gir,clen,dur,lmt&lsparams=mh,mm,mn,ms,mv,mvi,pcm2cms,pl,initcwndbps&lsig=AG3C_xAwRQIhAKiVIJi9FDmP7Fw1JKSAPs1R1-WkWzGCATwD8a_yAJbuAiBa0t4gha0PIfRw-U_IKoO_SlD9I6w8pKzK6Rnv0JyZZw==&alr=yes&sig=AOq0QJ8wRQIhAMSKgcjdFEjwtwVkVLdl0vLDlBuO7URWNcYxmb3uOYN8AiAPFNzsX7xi7GGoDxNSQ3jE8q3zI7SIcmSq3kBFY43kGA==&cpn=qcO0_bbtu_nw5kSS&cver=2.20220706.08.00&range=13360464-13827425&rn=275&rbuf=114997&pot=GpsBCm43A3uL5J5mdnP2Aqcg7x0XsBLorTKV_hQdn","rr2---sn-uqj-j2ik.googlevideo.com/videoplayback?expire=1657301059&ei=4xPIYsejLdaE0u8PisaH-As&ip=30.1.2.3&id=o-AFv-xEKlSerh7KLAqQpIv7lqMuInG7abjfsgIuxl43kC&itag=251&source=youtube&requiressl=yes&mh=1d&mm=31,29&mn=sn-uqj-j2ik,sn-5go7yner&ms=au,rdu&mv=m&mvi=2&pcm2cms=yes&pl=22&initcwndbps=2217500&spc=lT-KhsRY8qwGmkHJVEsoVP6X2T8w1I4&vprv=1&mime=audio/webm&ns=QWxF_PhMKjieFOZmr32qEI4H&gir=yes&clen=72710742&dur=4558.041&lmt=1652802983091490&mt=1657279033&fvip=5&keepalive=yes&fexp=24001373,24007246&c=WEB&txp=5532434&n=h1nHe02SxuOjBA&sparams=expire,ei,ip,id,itag,source,requiressl,spc,vprv,mime,ns,gir,clen,dur,lmt&lsparams=mh,mm,mn,ms,mv,mvi,pcm2cms,pl,initcwndbps&lsig=AG3C_xAwRQIhAKiVIJi9FDmP7Fw1JKSAPs1R1-WkWzGCATwD8a_yAJbuAiBa0t4gha0PIfRw-U_IKoO_SlD9I6w8pKzK6Rnv0JyZZw==&alr=yes&sig=AOq0QJ8wRQIhAMSKgcjdFEjwtwVkVLdl0vLDlBuO7URWNcYxmb3uOYN8AiAPFNzsX7xi7GGoDxNSQ3jE8q3zI7SIcmSq3kBFY43kGA==&cpn=qcO0_bbtu_nw5kSS&cver=2.20220706.08.00&range=13360464-13827425&rn=275&rbuf=114997&pot=GpsBCm43A3uL5J5mdnP2Aqcg7x0XsBLorTKV_hQdn",0,12,0,0,0,,PA-RH-FW1A,"rr2---sn-uqj-j2ik.googlevideo.com/videoplayback?expire=1657301059&ei=4xPIYsejLdaE0u8PisaH-As&ip=30.1.2.3&id=o-AFv-xEKlSerh7KLAqQpIv7lqMuInG7abjfsgIuxl43kC&itag=251&source=youtube&requiressl=yes&mh=1d&mm=31,29&mn=sn-uqj-j2ik,sn-5go7yner&ms=au,rdu&mv=m&mvi=2&pcm2cms=yes&pl=22&initcwndbps=2217500&spc=lT-KhsRY8qwGmkHJVEsoVP6X2T8w1I4&vprv=1&mime=audio/webm&ns=QWxF_PhMKjieFOZmr32qEI4H&gir=yes&clen=72710742&dur=4558.041&lmt=1652802983091490&mt=1657279033&fvip=5&keepalive=yes&fexp=24001373,24007246&c=WEB&txp=5532434&n=h1nHe02SxuOjBA&sparams=expire,ei,ip,id,itag,source,requiressl,spc,vprv,mime,ns,gir,clen,dur,lmt&lsparams=mh,mm,mn,ms,mv,mvi,pcm2cms,pl,initcwndbps&lsig=AG3C_xAwRQIhAKiVIJi9FDmP7Fw1JKSAPs1R1-WkWzGCATwD8a_yAJbuAiBa0t4gha0PIfRw-U_IKoO_SlD9I6w8pKzK6Rnv0JyZZw==&alr=yes&sig=AOq0QJ8wRQIhAMSKgcjdFEjwtwVkVLdl0vLDlBuO7URWNcYxmb3uOYN8AiAPFNzsX7xi7GGoDxNSQ3jE8q3zI7SIcmSq3kBFY43kGA==&cpn=qcO0_bbtu_nw5kSS&cver=2.20220706.08.00&range=13360464-13827425&rn=275&rbuf=114997&pot=GpsBCm43A3uL5J5mdnP2Aqcg7x0XsBLorTKV_hQdn",,,,0,,0,,N/A,unknown,AppThreat-8588-7456,0x0,0,4294967295,"rr2---sn-uqj-j2ik.googlevideo.com/videoplayback?expire=1657301059&ei=4xPIYsejLdaE0u8PisaH-As&ip=30.1.2.3&id=o-AFv-xEKlSerh7KLAqQpIv7lqMuInG7abjfsgIuxl43kC&itag=251&source=youtube&requiressl=yes&mh=1d&mm=31,29&mn=sn-uqj-j2ik,sn-5go7yner&ms=au,rdu&mv=m&mvi=2&pcm2cms=yes&pl=22&initcwndbps=2217500&spc=lT-KhsRY8qwGmkHJVEsoVP6X2T8w1I4&vprv=1&mime=audio/webm&ns=QWxF_PhMKjieFOZmr32qEI4H&gir=yes&clen=72710742&dur=4558.041&lmt=1652802983091490&mt=1657279033&fvip=5&keepalive=yes&fexp=24001373,24007246&c=WEB&txp=5532434&n=h1nHe02SxuOjBA&sparams=expire,ei,ip,id,itag,source,requiressl,spc,vprv,mime,ns,gir,clen,dur,lmt&lsparams=mh,mm,mn,ms,mv,mvi,pcm2cms,pl,initcwndbps&lsig=AG3C_xAwRQIhAKiVIJi9FDmP7Fw1JKSAPs1R1-WkWzGCATwD8a_yAJbuAiBa0t4gha0PIfRw-U_IKoO_SlD9I6w8pKzK6Rnv0JyZZw==&alr=yes&sig=AOq0QJ8wRQIhAMSKgcjdFEjwtwVkVLdl0vLDlBuO7URWNcYxmb3uOYN8AiAPFNzsX7xi7GGoDxNSQ3jE8q3zI7SIcmSq3kBFY43kGA==&cpn=qcO0_bbtu_nw5kSS&cver=2.20220706.08.00&range=13360464-13827425&rn=275&rbuf=114997&pot=GpsBCm43A3uL5J5mdnP2Aqcg7x0XsBLorTKV_hQdn","rr2---sn-uqj-j2ik.googlevideo.com/videoplayback?expire=1657301059&ei=4xPIYsejLdaE0u8PisaH-As&ip=30.1.2.3&id=o-AFv-xEKlSerh7KLAqQpIv7lqMuInG7abjfsgIuxl43kC&itag=251&source=youtube&requiressl=yes&mh=1d&mm=31,29&mn=sn-uqj-j2ik,sn-5go7yner&ms=au,rdu&mv=m&mvi=2&pcm2cms=yes&pl=22&initcwndbps=2217500&spc=lT-KhsRY8qwGmkHJVEsoVP6X2T8w1I4&vprv=1&mime=audio/webm&ns=QWxF_PhMKjieFOZmr32qEI4H&gir=yes&clen=72710742&dur=4558.041&lmt=1652802983091490&mt=1657279033&fvip=5&keepalive=yes&fexp=24001373,24007246&c=WEB&txp=5532434&n=h1nHe02SxuOjBA&sparams=expire,ei,ip,id,itag,source,requiressl,spc,vprv,mime,ns,gir,clen,dur,lmt&lsparams=mh,mm,mn,ms,mv,mvi,pcm2cms,pl,initcwndbps&lsig=AG3C_xAwRQIhAKiVIJi9FDmP7Fw1JKSAPs1R1-WkWzGCATwD8a_yAJbuAiBa0t4gha0PIfRw-U_IKoO_SlD9I6w8pKzK6Rnv0JyZZw==&alr=yes&sig=AOq0QJ8wRQIhAMSKgcjdFEjwtwVkVLdl0vLDlBuO7URWNcYxmb3uOYN8AiAPFNzsX7xi7GGoDxNSQ3jE8q3zI7SIcmSq3kBFY43kGA==&cpn=qcO0_bbtu_nw5kSS&cver=2.20220706.08.00&range=13360464-13827425&rn=275&rbuf=114997&pot=GpsBCm43A3uL5J5mdnP2Aqcg7x0XsBLorTKV_hQdn",ca6891d8-044c-433e-9675-6919df03b5a4,0,,,,,,,,,,,,,,,,,,,,,,,,,,,"rr2---sn-uqj-j2ik.googlevideo.com/videoplayback?expire=1657301059&ei=4xPIYsejLdaE0u8PisaH-As&ip=30.1.2.3&id=o-AFv-xEKlSerh7KLAqQpIv7lqMuInG7abjfsgIuxl43kC&itag=251&source=youtube&requiressl=yes&mh=1d&mm=31,29&mn=sn-uqj-j2ik,sn-5go7yner&ms=au,rdu&mv=m&mvi=2&pcm2cms=yes&pl=22&initcwndbps=2217500&spc=lT-KhsRY8qwGmkHJVEsoVP6X2T8w1I4&vprv=1&mime=audio/webm&ns=QWxF_PhMKjieFOZmr32qEI4H& 
@efd6
Copy link
Contributor

efd6 commented Jul 10, 2022

@LaZyDK is that event missing the final quote in the original event? AFAICS the pipeline here is not removing it.

@LaZyDK
Copy link
Contributor

LaZyDK commented Jul 11, 2022

It seems like it yes.
Is Panos sending too many bytes for Elastic agent to assemble it into the full event data?
It is a very long URI.

@efd6
Copy link
Contributor

efd6 commented Jul 11, 2022

So are is there other significant syntax that is missing? It sounds like there might be.

@LaZyDK
Copy link
Contributor

LaZyDK commented Jul 11, 2022

I will compare it to some of the other logs, and get back to you in a few hours.

@LaZyDK
Copy link
Contributor

LaZyDK commented Jul 12, 2022

I did compare to other events and found that some of my messages are being cut in length.
I found some indications in Palo Alto's documentation that max syslog size was 2048 byte in Panos 9 and is now 8000 byte in Panos 10.

@LaZyDK
Copy link
Contributor

LaZyDK commented Jul 12, 2022

As per RFC5424:

 Any transport receiver MUST be able to accept messages of up to and including 480 octets in length. All transport receiver implementations SHOULD be able to accept messages of up to and including 2048 octets in length. Transport receivers MAY receive messages larger than 2048 octets in length. If a transport receiver receives a message with a length larger than it supports, the transport receiver SHOULD truncate the payload. Alternatively, it MAY discard the message. 
@andrewkroh
Copy link
Member

andrewkroh commented Jul 12, 2022

@LaZyDK What input were you using? 8k should be fine for the inputs supported. If you temporarily enable debug for the Agent (https://www.elastic.co/guide/en/fleet/current/elastic-agent-logging.html#agent-logging-levels) do you see truncated messages on the Beat/Agent side by looking at the logs?

@LaZyDK
Copy link
Contributor

LaZyDK commented Jul 12, 2022

Looking at the event I sent you earlier it is over 10000 chars - without the syslog headers.
I will debug the agent.

@andrewkroh
Copy link
Member

andrewkroh commented Jul 12, 2022

I was working with @LaZyDK do figure out where the problem lies. At the moment it looks like PAN-OS might be sending the message without the final escaped quote. He's going to use the custom UDP input integration to capture the data and see if maybe it's the syslog processor that causing the issue. He doesn't have access to do a tcpdump so that's the next best thing.

@andrewkroh
Copy link
Member

Speaking of the local processing contained in the {udp,tcp}.yml.hbs files, in order to truly honor the preserve_original_event tag I think we need to set event.original on the Beat side before running the syslog processor. We want to copy the message into event.original before the syslog processor does any modifications to message.

We probably want to do this outside of this change and this probably affects other integrations that are using syslog. WDYT @taylor-swanson?

@taylor-swanson
Copy link
Contributor

Speaking of the local processing contained in the {udp,tcp}.yml.hbs files, in order to truly honor the preserve_original_event tag I think we need to set event.original on the Beat side before running the syslog processor. We want to copy the message into event.original before the syslog processor does any modifications to message.

We probably want to do this outside of this change and this probably affects other integrations that are using syslog. WDYT @taylor-swanson?

That sounds good to me. It's true that we'll probably want to evaluate this on a per-integration case to be safe, but that should be the general way of doing it.

@taylor-swanson
Copy link
Contributor

It's also worth looking at RFC 5426 (Transmission of Syslog Messages over UDP). It clearly states that there must only be one message per datagram, in which that message should either fit within that bound or be truncated (which seems to be the case here). The size of the datagram will of course rely on external factors (what PAN-OS is doing, MTU, etc). Of course PAN-OS could ignore all of this, but if it tries to send the message over multiple datagrams, the UDP input and syslog processor will NOT reassemble the message.

If we expect messages to exceed MTU (among other factors), we should be using TCP here, not UDP.

@vinit-chauhan
Copy link
Contributor Author

Hey @LaZyDK,
For the UDP input, the default max_message_size is 10KiB (https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-input-udp.html#filebeat-input-udp-udp-max-message-size) and so Syslog of size greater than 10KiB is getting truncated and so entire event sent by PAN-OS is not getting ingested completely.

In doc-https://docs.paloaltonetworks.com/pan-os/10-2/pan-os-admin/user-id/user-id-concepts/user-mapping/syslog, it is mentioned that The maximum size for individual messages is 8,000 bytes., but this doc is for User-ID Integration with Syslog.

We recommend using TCP input since the default max_message_size is 20MiB (https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-input-tcp.html#filebeat-input-tcp-tcp-max-message-size), but still if you want to use UDP input, we can set value for max_message_size in udp.yml.hbs file.

@andrewkroh
Copy link
Member

@vinit-elastic Let's expose the max_message_size as an advanced setting for TCP and UDP and set the default to allow receiving the expected size of the pan-os 10.x messages. Let's default it to 50 KiB for both. That should be more than sufficient.

@LaZyDK said that increasing the max_message_size when using the custom udp input integration fixed the truncation issue.

@vinit-chauhan
Copy link
Contributor Author

Sure @andrewkroh, it makes sense. I'll update the PR. 👍🏻

@LaZyDK
Copy link
Contributor

LaZyDK commented Jul 18, 2022

Well done. Test and push :D

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

Labels

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

6 participants