Skip to content

[o365] Better handling of address formats#2669

Merged
adriansr merged 7 commits intoelastic:mainfrom
adriansr:o365_fix_2660
Feb 17, 2022
Merged

[o365] Better handling of address formats#2669
adriansr merged 7 commits intoelastic:mainfrom
adriansr:o365_fix_2660

Conversation

@adriansr
Copy link
Contributor

@adriansr adriansr commented Feb 10, 2022

What does this PR do?

  • Supports bracketed format in ClientIP, ClientIPAddress, and OriginatingServer fields.
  • Fixes grok error with invalid IPs. o365: Grok parsing errors due to invalid IP addresses #2660
  • Cleanup: Remove unnecessary event.ingested from pipeline.
  • Better logic for populating {client,server}.address.
  • Improves? some grok expressions ((%{NOTSPACE:...}|%{HOSTNAME:...}))
  • Safer handling of IPv4 mapped IPv6 addresses (::ffff:A.B.C.D).

Closes #2660
Relates #2519

This removes event.ingested from the pipeline (unnecessary) and
re-generates the log so that keys are now sorted, for easier comparison
of changes.
This updates the O365 integration pipeline to support a new format that
has been observed in the OriginatingServer field from O365.

It also refactors the logic around address field population and prevents
failures when invalid IPs are reported.

Closes #2660
Relates #2519
@legoguy1000
Copy link
Contributor

Looks like u made additional changes than I did. I can close mine if u want?

@elasticmachine
Copy link

elasticmachine commented Feb 10, 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-02-16T18:10:27.388+0000

  • Duration: 23 min 23 sec

Test stats 🧪

Test Results
Failed 0
Passed 28
Skipped 0
Total 28

🤖 GitHub comments

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

  • /test : Re-trigger the build.

@adriansr
Copy link
Contributor Author

adriansr commented Feb 10, 2022

Thanks for your PR, @legoguy1000, much appreciated.

I took the opportunity to make more changes that I felt necessary in this case, so yes, better keep this one instead.

  • Support "host (ip)" pair in brackets: [HOSTNAME (IP)].
  • Populate .address fields directly. The temporary ._address is unnecessary.
  • Simplify a few grok expressions:
    • Better not to use grok's IP type at all and rely on the later convert processor (This only applies to the "host (ip)" formats, as those are the only ones observed to include invalid IPs).
    • Replace usages of (%{NOTSPACE:...}|%{HOSTNAME:...}) with %{NOTSPACE:...}. NOTSPACE is a superset of HOSTNAME.
  • Review potentially wrong "::ffff:" gsub expression.

@andrewkroh andrewkroh added the Integration:o365 Microsoft Office 365 label Feb 11, 2022
@adriansr adriansr changed the title O365 fix 2660 O365: Better handling of address formats Feb 15, 2022
@adriansr adriansr added the bug Something isn't working, use only for issues label Feb 15, 2022
@adriansr adriansr marked this pull request as ready for review February 15, 2022 10:22
@adriansr adriansr requested review from a team and P1llus February 15, 2022 17:16
@elasticmachine
Copy link

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

@andrewkroh andrewkroh changed the title O365: Better handling of address formats [o365] Better handling of address formats Feb 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working, use only for issues Integration:o365 Microsoft Office 365

Projects

None yet

Development

Successfully merging this pull request may close these issues.

o365: Grok parsing errors due to invalid IP addresses

4 participants