-
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] Update process metricset #9139
[Auditbeat] Update process metricset #9139
Conversation
Pinging @elastic/secops |
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.
Will finish reviewing tomorrow.
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.
Please leverage process.
as much as possible, and I'll be good with the PR 👍🏼
Note that I haven't looked at the code closely nor tried the module yet. I'll do that next week, when a few of the modules are available in one build.
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.
Overall LGTM. We need to move some of the process fields up to the process
namespace before merging.
} | ||
|
||
func (ms *MetricSet) getProcessInfos() ([]*ProcessInfo, error) { | ||
// TODO: Implement Processes() in go-sysinfo |
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.
When we merge to master we should collect a list of the open TODOs in the module and make sure we don't forget to address them. This one would be caught be CI once we have it running on darwin.
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.
You mean the CI will fail when there are TODO
comments in the code? I've been using them quite liberally, also for minor things that we can address anytime (maybe never, to be honest).
Kind of as breadcrumbs meaning "If somebody ever touches this code again and has some spare cycles, maybe do this".
// e.g. https://github.com/elastic/go-sysinfo/blob/master/providers/darwin/process_darwin_amd64.go#L41 | ||
pids, err := process.Pids() | ||
if err != nil { | ||
return nil, errors.Wrap(err, "Failed to fetch the list of PIDs") |
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.
Error strings should not be capitalized. This occurs in a few places. https://github.com/golang/go/wiki/CodeReviewComments#declaring-empty-slices
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.
Thanks - done. I seem to be doing this a lot, so I built myself a patched version of golint
that works with errors.Wrap(f)
. Hopefully I caught all of them this time.
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.
Nice. Hound needs this.
Fields are moved to top-level As a follow-up, |
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.
Yes, this looks good. Only one last json file that seems to use start_time
dc62e3a
to
d5c5692
Compare
Updates the `process` metricset to follow newest conventions: - Rename from `processes` to `process` - Change to single documents instead of arrays - Scheduled state reporting - Use top-level ECS fields
(Sorry for the vague name - maybe I should have done this in multiple PRs, but since this is still going into the features branch I didn't want to make it too complicated.)
Following all our discussions and decisions the initial implementation of the
processes
metricset was rather outdated (same withhost
andpackages
). This PR basically updates it to follow the newest conventions (esp. those laid out in the now mergeduser
metricset).High-level changes:
processes
toprocess
Even though I used
git mv
it seems Github is showingprocess.go
as completely new in the PR view. Since these are just two commits it might be easier to look at them directly: