-
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] Login metricset #9327
Merged
Merged
Changes from all commits
Commits
Show all changes
54 commits
Select commit
Hold shift + click to select a range
2774cbc
First working version.
172273a
Use filepath pattern to catch rotated files.
1cf7585
Add state.
81831e2
Test data.
bd03a7f
Exclude empty fields from event.
a657a25
TTY lookup.
7675662
UTMP debug log.
4f712a7
Add LoginRecord.UID.
980225b
Move structs to their proper files.
feb3685
Move FileRecord to utmp.go.
f7dcb48
Move most logic to utmp.go.
1051f20
Properly separate logic, add all event logic.
eb9c40a
Add TODO comments.
e467633
Use top-level fields where possible.
126230b
Update test data.
760d46e
Update fields.yml.
4cfac44
Minor improvements.
a54c658
Config.
2f0bc9d
Hound fixes.
e05e58f
Add cgo to build tags.
0b2c555
Change event.summary to message.
944b9ce
Revert validate:required.
6e446d5
Change to source.domain.
7cc8c03
Change constants to loginRecordType.
6bdb263
Remove fileInfos().
ea48b62
mage update
51194c2
Config and docs adjustments.
6680660
Lowercase config.
e0c66da
Namespace
e602899
Addressed some minor review comments.
7fa836f
Pure Go reader.
ad2220f
Remove now unneeded seccomp action.
1458563
Make file re-reading non-recursive.
a7ca217
Use channels instead of passing arrays to reduce memory footprint.
0823d7e
Save offset instead of last read record.
9c9e1b6
Handle failed logins from btmp files as well.
9774ca0
System test
04af736
Remove unreachable code.
3b8ed59
Make Hound happy
175c992
Change to user.terminal and document event.origin
3b8002a
Config and docs.
1a8bbbc
Changelog
5915f85
Update data.json
3617549
Test with samle wtmp file.
3e21182
Remove cgo build constraint.
03eedee
Improve message string building.
539feb4
Add UtType.
0453ce2
Respect machine byte order.
028663d
Fix debug message.
c649510
Correct type for all UtType values.
b1f70fb
Skip login dataset tests when not on a little-endian system.
fe229c7
mage update
71d61c2
Remove user.id from system test.
d0b1969
Fix unit test in integration env.
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
//// | ||
This file is generated! See scripts/docs_collector.py | ||
//// | ||
|
||
[id="{beatname_lc}-dataset-system-login"] | ||
=== System login dataset | ||
|
||
include::../../../module/system/login/_meta/docs.asciidoc[] | ||
|
||
|
||
==== Fields | ||
|
||
For a description of each field in the dataset, see the | ||
<<exported-fields-system,exported fields>> section. | ||
|
||
Here is an example document generated by this dataset: | ||
|
||
[source,json] | ||
---- | ||
include::../../../module/system/login/_meta/data.json[] | ||
---- |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"@timestamp": "2017-10-12T08:05:34.853Z", | ||
"agent": { | ||
"hostname": "host.example.com", | ||
"name": "host.example.com" | ||
}, | ||
"event": { | ||
"action": "user_login", | ||
"dataset": "login", | ||
"module": "system", | ||
"origin": "/var/log/wtmp.1", | ||
"outcome": "success", | ||
"type": "event" | ||
}, | ||
"message": "Login by user vagrant (UID: 1000) on pts/1 (PID: 17559) from 10.0.2.2 (IP: 10.0.2.2)", | ||
"process": { | ||
"pid": 17559 | ||
}, | ||
"service": { | ||
"type": "system" | ||
}, | ||
"source": { | ||
"ip": "10.0.2.2" | ||
}, | ||
"user": { | ||
"id": 1000, | ||
"name": "vagrant", | ||
"terminal": "pts/1" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[role="xpack"] | ||
|
||
experimental[] | ||
|
||
This is the `login` dataset of the system module. | ||
|
||
It is implemented for Linux only. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
// or more contributor license agreements. Licensed under the Elastic License; | ||
// you may not use this file except in compliance with the Elastic License. | ||
|
||
// +build linux | ||
|
||
package login | ||
|
||
// config defines the metricset's configuration options. | ||
type config struct { | ||
WtmpFilePattern string `config:"login.wtmp_file_pattern"` | ||
BtmpFilePattern string `config:"login.btmp_file_pattern"` | ||
} | ||
|
||
func defaultConfig() config { | ||
return config{ | ||
WtmpFilePattern: "/var/log/wtmp*", | ||
BtmpFilePattern: "/var/log/btmp*", | ||
} | ||
} |
Oops, something went wrong.
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.
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.
I think it would be good to open a PR to elastic/ecs suggesting that this be added. I think the auditd module gives tty info.
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.
It does. #10192 will fill
process.terminal
for the Filebeat auditd module. I wonder if we should use the same field, and whether it should beuser.terminal
orprocess.terminal
. @andrewkroh @webmat what do you think?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.
Yeah in my PR I've been mapping both
auditd.log.tty
andauditd.log.terminal
toprocess.terminal
, thinking it was inconsistency on the auditd side. This makes me wonder if one is actually user-specific and one process-specific. I'll dig into this some more for my PR.But I do think
user.terminal
makes sense, if you have terminal info for users.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.
Found some light reading for the week-end: Auditd field dictionary