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

Match logs without junos@ip #5125

Merged
merged 3 commits into from
Feb 3, 2023
Merged

Match logs without junos@ip #5125

merged 3 commits into from
Feb 3, 2023

Conversation

ernst-s
Copy link
Contributor

@ernst-s ernst-s commented Jan 27, 2023

Change grok pattern to match SRX logs which don't containt the junos@ip before the other fields. Prevents stripping of the first field.

  • Enhancement

What does this PR do?

Changes grok pattern to match both styles of logs.
Current pattern removes the first field of the logs without junos@IP.
See example below for both types of logs:

Example recent branch SRX:

<14>1 2023-01-26T09:37:51.184+01:00 SRX-GW1 RT_FLOW - RT_FLOW_SESSION_CREATE [source-address="10.0.0.1" source-port="594" destination-address="67.43.156.13" destination-port="10400" connection-tag="0" service-name="icmp" nat-source-address="10.0.0.1" nat-source-port="594" nat-destination-address="67.43.156.13" nat-destination-port="10400" nat-connection-tag="0" src-nat-rule-type="N/A" src-nat-rule-name="N/A" dst-nat-rule-type="N/A" dst-nat-rule-name="N/A" protocol-id="1" policy-name="vpn_trust_permit-all" source-zone-name="vpn" destination-zone-name="trust" session-id-32="6093" username="N/A" roles="N/A" packet-incoming-interface="st0.0" application="UNKNOWN" nested-application="UNKNOWN" encrypted="UNKNOWN" application-category="N/A" application-sub-category="N/A" application-risk="1" application-characteristics="N/A"]

Currently correctly parsed format:
<14>1 2019-11-14T09:37:51.184+01:00 SRX-GW1 RT_FLOW - RT_FLOW_SESSION_CREATE [junos@67.43.156.15 source-address="10.0.0.1" source-port="594" destination-address="67.43.156.13" destination-port="10400" connection-tag="0" service-name="icmp" nat-source-address="10.0.0.1" nat-source-port="594" nat-destination-address="67.43.156.13" nat-destination-port="10400" nat-connection-tag="0" src-nat-rule-type="N/A" src-nat-rule-name="N/A" dst-nat-rule-type="N/A" dst-nat-rule-name="N/A" protocol-id="1" policy-name="vpn_trust_permit-all" source-zone-name="vpn" destination-zone-name="trust" session-id-32="6093" username="N/A" roles="N/A" packet-incoming-interface="st0.0" application="UNKNOWN" nested-application="UNKNOWN" encrypted="UNKNOWN" application-category="N/A" application-sub-category="N/A" application-risk="1" application-characteristics="N/A"]

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.

Change grok pattern to match SRX logs which don't containt the junos@ip before the other fields. Prevents stripping of the first field.
@ernst-s ernst-s requested a review from a team as a code owner January 27, 2023 09:01
@cla-checker-service
Copy link

cla-checker-service bot commented Jan 27, 2023

💚 CLA has been signed

@elasticmachine
Copy link

elasticmachine commented Jan 27, 2023

💚 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: 2023-02-03T05:53:22.562+0000

  • Duration: 16 min 4 sec

Test stats 🧪

Test Results
Failed 0
Passed 13
Skipped 0
Total 13

🤖 GitHub comments

Expand to view the GitHub comments

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

  • /test : Re-trigger the build.

@elasticmachine
Copy link

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

Copy link
Contributor

@kcreddy kcreddy left a comment

Choose a reason for hiding this comment

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

Hey @ernst-s
Could you please sign the CLA and make following changes to the PR:

  1. Add changelog.yml entry and update version in manifest.yml
  2. Add your test log sample to this file and run package tests

@ernst-s
Copy link
Contributor Author

ernst-s commented Jan 31, 2023

I signed the CLA. (and used the correct e-mail for the commit )

@kcreddy
Copy link
Contributor

kcreddy commented Feb 2, 2023

/test

@elasticmachine
Copy link

elasticmachine commented Feb 2, 2023

🌐 Coverage report

Name Metrics % (covered/total) Diff
Packages 100.0% (1/1) 💚
Files 100.0% (7/7) 💚 2.463
Classes 100.0% (7/7) 💚 2.463
Methods 100.0% (50/50) 💚 8.603
Lines 70.799% (1525/2154) 👎 -21.409
Conditionals 100.0% (0/0) 💚

@ernst-s ernst-s requested a review from kcreddy February 2, 2023 16:09
@kcreddy
Copy link
Contributor

kcreddy commented Feb 3, 2023

/test

Copy link
Contributor

@kcreddy kcreddy left a comment

Choose a reason for hiding this comment

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

LGTM

@kcreddy kcreddy merged commit 5b92311 into elastic:main Feb 3, 2023
@ernst-s ernst-s deleted the patch-1 branch February 3, 2023 10:48
@elasticmachine
Copy link

Package juniper_srx - 1.9.0 containing this change is available at https://epr.elastic.co/search?package=juniper_srx

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

Successfully merging this pull request may close these issues.

None yet

4 participants