-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[Auditbeat] New system/socket dataset using kprobes tracing events #13058
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
adriansr
force-pushed
the
feature_ab_tracing
branch
3 times, most recently
from
July 25, 2019 09:38
5b23666
to
7d5985f
Compare
adriansr
force-pushed
the
feature_ab_tracing
branch
from
August 21, 2019 23:18
dc3b9cc
to
f3b8e9f
Compare
This is a perf API client candidate for golang.org/x/sys/unix/linux/perf which is currently in review at: https://go-review.googlesource.com/c/sys/+/168059 The Elastic fork adds some features on top of it: - OpenWithFlags() to pass custom flags to perf_event_open(2), necessary for managing our own event groups. - HasRecord() to peek a ring buffer without blocking. Necessary to read multiple rings in parallel from a single goroutine. And also some fixes: - Fix bad handling of ring buffer memory. - Add error checking to prevent crashes due to corrupted samples.
Package tracing provides a set of tools built on top of golang.org/x/sys/unix/linux/perf that simplify working with KProbes and UProbes, using tracing perf channels to receive events from the kernel and decoding of this raw events into more useful types.
adriansr
force-pushed
the
feature_ab_tracing
branch
from
August 22, 2019 21:57
8b798b0
to
05a6b32
Compare
adriansr
force-pushed
the
feature_ab_tracing
branch
from
August 28, 2019 18:46
ae177d2
to
5a78c37
Compare
jsoriano
approved these changes
Aug 28, 2019
// timeout. | ||
const executorQueueSize = 1 | ||
thread := helper.NewFixedThreadExecutor(executorQueueSize) | ||
defer thread.Close() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clearer now with this approach 👍
// FixedThreadExecutor runs tasks on a fixed OS thread (see runtime.LockOSThread). | ||
type FixedThreadExecutor struct { | ||
// TID is the OS identifier for the thread where it is running. | ||
TID int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Supernit. Make TID a method so it is read-only.
andrewkroh
pushed a commit
to andrewkroh/beats
that referenced
this pull request
Aug 29, 2019
…lastic#13058) This patch replaces the original `system/socket` dataset which used netlink to periodically poll the system for open sockets. In the new implementation, kprobe-based tracing is used to receive events of interest related to function calls and their arguments inside the kernel tcp/ip stack. From this stream of information the dataset constructs a model of all the network sockets in use and the processes running in the system at any given time. This allows the dataset to produce flow-like events with information like packets and bytes counters, originator process and user, with little impact to system performance and without missing short-lived sockets or processes. The dataset is in beta. (cherry picked from commit b1893f2)
andrewkroh
added a commit
that referenced
this pull request
Aug 29, 2019
…13058) (#13397) This patch replaces the original `system/socket` dataset which used netlink to periodically poll the system for open sockets. In the new implementation, kprobe-based tracing is used to receive events of interest related to function calls and their arguments inside the kernel tcp/ip stack. From this stream of information the dataset constructs a model of all the network sockets in use and the processes running in the system at any given time. This allows the dataset to produce flow-like events with information like packets and bytes counters, originator process and user, with little impact to system performance and without missing short-lived sockets or processes. The dataset is in beta. (cherry picked from commit b1893f2)
adriansr
added a commit
to adriansr/beats
that referenced
this pull request
Aug 30, 2019
adriansr
added a commit
that referenced
this pull request
Aug 30, 2019
adriansr
added a commit
to adriansr/beats
that referenced
this pull request
Aug 30, 2019
Relates elastic#13058 (cherry picked from commit 6a79ba0)
adriansr
added a commit
that referenced
this pull request
Aug 30, 2019
adriansr
added a commit
to adriansr/beats
that referenced
this pull request
Sep 4, 2019
This fixes a known problem with the system/socket dataset. Before 3.13 an extra level of indirection is needed to access IPv6 addresses from a struct inet_sock. Relates elastic#13058
adriansr
added a commit
that referenced
this pull request
Sep 5, 2019
This fixes a known problem with the system/socket dataset. Before 3.13 an extra level of indirection is needed to access IPv6 addresses from a struct inet_sock. Relates #13058
adriansr
added a commit
to adriansr/beats
that referenced
this pull request
Sep 5, 2019
This fixes a known problem with the system/socket dataset. Before 3.13 an extra level of indirection is needed to access IPv6 addresses from a struct inet_sock. Relates elastic#13058 (cherry picked from commit dc6c013)
adriansr
added a commit
that referenced
this pull request
Sep 6, 2019
This was referenced Sep 6, 2019
leweafan
pushed a commit
to leweafan/beats
that referenced
this pull request
Apr 28, 2023
…lastic#13058) (elastic#13397) This patch replaces the original `system/socket` dataset which used netlink to periodically poll the system for open sockets. In the new implementation, kprobe-based tracing is used to receive events of interest related to function calls and their arguments inside the kernel tcp/ip stack. From this stream of information the dataset constructs a model of all the network sockets in use and the processes running in the system at any given time. This allows the dataset to produce flow-like events with information like packets and bytes counters, originator process and user, with little impact to system performance and without missing short-lived sockets or processes. The dataset is in beta. (cherry picked from commit e4ae0d5)
leweafan
pushed a commit
to leweafan/beats
that referenced
this pull request
Apr 28, 2023
…ic#13456) Relates elastic#13058 (cherry picked from commit e8c1479)
leweafan
pushed a commit
to leweafan/beats
that referenced
this pull request
Apr 28, 2023
elastic#13523) This fixes a known problem with the system/socket dataset. Before 3.13 an extra level of indirection is needed to access IPv6 addresses from a struct inet_sock. Relates elastic#13058 (cherry picked from commit ced7862)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR replaces the original
system/socket
dataset which used netlink to periodically poll the system for open sockets.In the new implementation, kprobe-based tracing is used to receive events of interest related to function calls and their arguments inside the kernel TCP/IP stack. From this stream of information the dataset constructs a model of all the network sockets in use and the processes running in the system at any given time.
This allows the dataset to produce flow-like events with information like packets and bytes counters, originator process and user, with little impact to system performance and without missing short-lived sockets or processes.
The dataset supports TCP and UDP sockets for both IPv4 and IPv6.
TODO
There is some, but please review:
Notes to reviewers
You can skip the first two commits (vendored packages):