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

[Automatic Import] Introduce support for structured logs #191749

Merged
merged 16 commits into from
Sep 10, 2024

Conversation

bhapas
Copy link
Contributor

@bhapas bhapas commented Aug 29, 2024

Release note

Adds a feature to implement support for syslogs with structured message body

Summary

This PR introduces KVGraph that is used to support structured log samples.

Examples of structured log samples would be:

<134>1 1639132850.430422377 AP1 events type=disassociation radio='1' vap='1' client_mac='B0:A4:60:9B:3B:A6' channel='100' reason='1' instigator='2' duration='223.031691642' auth_neg_dur='0.005054229' last_auth_ago='223.020414600' is_wpa='1' full_conn='0.384002374' ip_resp='0.384002374' ip_src='10.197.39.50' http_resp='0.647356228' arp_resp='0.013562625' arp_src='10.197.39.50' dns_server='10.128.128.128' dns_req_rtt='0.023370084' dns_resp='0.263616104' dhcp_lease_completed='0.009196083' dhcp_server='10.128.128.128' dhcp_server_mac='E0:CB:BC:31:23:60' dhcp_resp='0.009196083' aid='977866432'

Currently the tests prove that it works best with the log samples adhering to RFC5424 and RFC3164. The Graph shall be improved to work with Custom Formats going forward.

Checklist

For maintainers

@bhapas bhapas self-assigned this Aug 29, 2024
@bhapas bhapas changed the title [Automatic Import] Introduce support for structured syslogs [Automatic Import] Introduce support for structured logs Sep 4, 2024
@bhapas bhapas added backport:skip This commit does not require backporting release_note:feature Makes this part of the condensed release notes v8.16.0 Team:Security-Scalability Team label for Security Integrations Scalability Team labels Sep 6, 2024
@bhapas bhapas marked this pull request as ready for review September 6, 2024 10:28
@bhapas bhapas requested a review from a team as a code owner September 6, 2024 10:28
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-scalability (Team:Security-Scalability)

@bhapas bhapas requested a review from semd September 6, 2024 10:33
@bhapas
Copy link
Contributor Author

bhapas commented Sep 6, 2024

@elasticmachine merge upstream

@bhapas
Copy link
Contributor Author

bhapas commented Sep 9, 2024

@elasticmachine merge upstream

@bhapas bhapas requested a review from semd September 9, 2024 12:30
Copy link
Contributor

@semd semd left a comment

Choose a reason for hiding this comment

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

LGTM!

Comment on lines +26 to +30
- If the syslog samples have structured body then classify it as "log_type: structured".
- If the syslog samples have unstructured body then classify it as "log_type: unstructured".
- If the syslog samples follow a csv format then classify it as "log_type: csv".
- If the samples are identified as "csv" and there is a csv header then set "header: true" , else set "header: false".
- If you do not find the log format in any of the above categories then classify it as "log_type: unsupported".
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need to add/update any documentation around what we do and do not support?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah. The documentation update is a followup task for the additional log formats being introduced. I think we should make a public doc somewhere and link it to UI.. This is a change we wait for UX to get along.
@ebeahan WDYT?

@bhapas bhapas requested a review from kgeller September 9, 2024 19:58
@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
integrationAssistant 947.3KB 947.8KB +532.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @bhapas

@bhapas bhapas merged commit 08f70b7 into elastic:main Sep 10, 2024
21 checks passed
@kgeller kgeller added backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) and removed backport:skip This commit does not require backporting labels Sep 11, 2024
@kibanamachine
Copy link
Contributor

💔 All backports failed

Status Branch Result
8.15 Backport failed because of merge conflicts

Manual backport

To create the backport manually run:

node scripts/backport --pr 191749

Questions ?

Please refer to the Backport tool documentation

bhapas added a commit to bhapas/kibana that referenced this pull request Sep 11, 2024
)

## Summary

This PR introduces `KVGraph` that is used to support `structured` log
samples.

Examples of structured log samples would be:

```
<134>1 1639132850.430422377 AP1 events type=disassociation radio='1' vap='1' client_mac='B0:A4:60:9B:3B:A6' channel='100' reason='1' instigator='2' duration='223.031691642' auth_neg_dur='0.005054229' last_auth_ago='223.020414600' is_wpa='1' full_conn='0.384002374' ip_resp='0.384002374' ip_src='10.197.39.50' http_resp='0.647356228' arp_resp='0.013562625' arp_src='10.197.39.50' dns_server='10.128.128.128' dns_req_rtt='0.023370084' dns_resp='0.263616104' dhcp_lease_completed='0.009196083' dhcp_server='10.128.128.128' dhcp_server_mac='E0:CB:BC:31:23:60' dhcp_resp='0.009196083' aid='977866432'
```

Currently the tests prove that it works best with the log samples
adhering to `RFC5424` and `RFC3164`. The Graph shall be improved to work
with `Custom Formats` going forward.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 08f70b7)

# Conflicts:
#	x-pack/plugins/integration_assistant/common/api/ecs/ecs_route.ts
@bhapas
Copy link
Contributor Author

bhapas commented Sep 11, 2024

💚 All backports created successfully

Status Branch Result
8.15

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

bhapas added a commit that referenced this pull request Sep 11, 2024
) (#192539)

# Backport

This will backport the following commits from `main` to `8.15`:
- [[Automatic Import] Introduce support for structured logs
(#191749)](#191749)

<!--- Backport version: 8.9.8 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Bharat
Pasupula","email":"123897612+bhapas@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-09-10T16:36:04Z","message":"[Automatic
Import] Introduce support for structured logs (#191749)\n\n##
Summary\r\n\r\nThis PR introduces `KVGraph` that is used to support
`structured` log\r\nsamples.\r\n\r\nExamples of structured log samples
would be:\r\n\r\n```\r\n<134>1 1639132850.430422377 AP1 events
type=disassociation radio='1' vap='1' client_mac='B0:A4:60:9B:3B:A6'
channel='100' reason='1' instigator='2' duration='223.031691642'
auth_neg_dur='0.005054229' last_auth_ago='223.020414600' is_wpa='1'
full_conn='0.384002374' ip_resp='0.384002374' ip_src='10.197.39.50'
http_resp='0.647356228' arp_resp='0.013562625' arp_src='10.197.39.50'
dns_server='10.128.128.128' dns_req_rtt='0.023370084'
dns_resp='0.263616104' dhcp_lease_completed='0.009196083'
dhcp_server='10.128.128.128' dhcp_server_mac='E0:CB:BC:31:23:60'
dhcp_resp='0.009196083' aid='977866432'\r\n```\r\n\r\nCurrently the
tests prove that it works best with the log samples\r\nadhering to
`RFC5424` and `RFC3164`. The Graph shall be improved to work\r\nwith
`Custom Formats` going forward.\r\n\r\n\r\n### Checklist\r\n\r\n- [x]
[Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n\r\n### For
maintainers\r\n\r\n- [ ] This was checked for breaking API changes and
was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by:
Elastic Machine
<elasticmachine@users.noreply.github.com>\r\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"08f70b70371f68a5fc419298b02b76aa1e893a8b","branchLabelMapping":{"^v8.16.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:feature","backport:prev-minor","v8.16.0","Team:Security-Scalability"],"number":191749,"url":"https://github.com/elastic/kibana/pull/191749","mergeCommit":{"message":"[Automatic
Import] Introduce support for structured logs (#191749)\n\n##
Summary\r\n\r\nThis PR introduces `KVGraph` that is used to support
`structured` log\r\nsamples.\r\n\r\nExamples of structured log samples
would be:\r\n\r\n```\r\n<134>1 1639132850.430422377 AP1 events
type=disassociation radio='1' vap='1' client_mac='B0:A4:60:9B:3B:A6'
channel='100' reason='1' instigator='2' duration='223.031691642'
auth_neg_dur='0.005054229' last_auth_ago='223.020414600' is_wpa='1'
full_conn='0.384002374' ip_resp='0.384002374' ip_src='10.197.39.50'
http_resp='0.647356228' arp_resp='0.013562625' arp_src='10.197.39.50'
dns_server='10.128.128.128' dns_req_rtt='0.023370084'
dns_resp='0.263616104' dhcp_lease_completed='0.009196083'
dhcp_server='10.128.128.128' dhcp_server_mac='E0:CB:BC:31:23:60'
dhcp_resp='0.009196083' aid='977866432'\r\n```\r\n\r\nCurrently the
tests prove that it works best with the log samples\r\nadhering to
`RFC5424` and `RFC3164`. The Graph shall be improved to work\r\nwith
`Custom Formats` going forward.\r\n\r\n\r\n### Checklist\r\n\r\n- [x]
[Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n\r\n### For
maintainers\r\n\r\n- [ ] This was checked for breaking API changes and
was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by:
Elastic Machine
<elasticmachine@users.noreply.github.com>\r\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"08f70b70371f68a5fc419298b02b76aa1e893a8b"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.16.0","labelRegex":"^v8.16.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/191749","number":191749,"mergeCommit":{"message":"[Automatic
Import] Introduce support for structured logs (#191749)\n\n##
Summary\r\n\r\nThis PR introduces `KVGraph` that is used to support
`structured` log\r\nsamples.\r\n\r\nExamples of structured log samples
would be:\r\n\r\n```\r\n<134>1 1639132850.430422377 AP1 events
type=disassociation radio='1' vap='1' client_mac='B0:A4:60:9B:3B:A6'
channel='100' reason='1' instigator='2' duration='223.031691642'
auth_neg_dur='0.005054229' last_auth_ago='223.020414600' is_wpa='1'
full_conn='0.384002374' ip_resp='0.384002374' ip_src='10.197.39.50'
http_resp='0.647356228' arp_resp='0.013562625' arp_src='10.197.39.50'
dns_server='10.128.128.128' dns_req_rtt='0.023370084'
dns_resp='0.263616104' dhcp_lease_completed='0.009196083'
dhcp_server='10.128.128.128' dhcp_server_mac='E0:CB:BC:31:23:60'
dhcp_resp='0.009196083' aid='977866432'\r\n```\r\n\r\nCurrently the
tests prove that it works best with the log samples\r\nadhering to
`RFC5424` and `RFC3164`. The Graph shall be improved to work\r\nwith
`Custom Formats` going forward.\r\n\r\n\r\n### Checklist\r\n\r\n- [x]
[Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n\r\n### For
maintainers\r\n\r\n- [ ] This was checked for breaking API changes and
was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by:
Elastic Machine
<elasticmachine@users.noreply.github.com>\r\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"08f70b70371f68a5fc419298b02b76aa1e893a8b"}}]}]
BACKPORT-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) release_note:feature Makes this part of the condensed release notes Team:Security-Scalability Team label for Security Integrations Scalability Team v8.15.2 v8.16.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants