-
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
Teach elasticsearch/audit
fileset to handle timestamps correctly
#15942
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f06e72b
Add samples from ES 7.1.1 audit log
ycombinator 8105784
When JSON logs contain @timestamp and TZ is detected, use detected TZ
ycombinator 1bace41
Add CHANGELOG entry
ycombinator 7ee2045
Remove redundant guard
ycombinator b1c9d27
Revert unrelated change
ycombinator 741e892
s/teach/improve/ in changelog entry
ycombinator 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{"@timestamp":"2019-09-05T14:02:37,921", "node.id":"UwRu4mReRtyJO1-FWAPvIQ", "event.type":"transport", "event.action":"authentication_success", "user.name":"_system", "origin.type":"local_node", "origin.address":"127.0.0.1:9300", "realm":"__fallback", "request.id":"474ZciqtQteOhjLO3OdZIw", "action":"indices:monitor/stats", "request.name":"IndicesStatsRequest"} | ||
{"@timestamp":"2020-01-29T09:41:10,856", "node.id":"DJKjhISiTzy-JY5nCU8h3Q", "event.type":"transport", "event.action":"access_granted", "user.name":"_xpack_security", "user.realm":"__attach", "user.roles":["superuser"], "origin.type":"local_node", "origin.address":"127.0.0.1:9300", "request.id":"I9bQCw28Qfe4HWtIJHgoAg", "action":"cluster:admin/xpack/security/realm/cache/clear", "request.name":"ClearRealmCacheRequest"} | ||
{"@timestamp":"2020-01-29T09:41:10,859", "node.id":"DJKjhISiTzy-JY5nCU8h3Q", "event.type":"transport", "event.action":"access_granted", "user.name":"_xpack_security", "user.realm":"__attach", "user.roles":["superuser"], "origin.type":"local_node", "origin.address":"127.0.0.1:9300", "request.id":"I9bQCw28Qfe4HWtIJHgoAg", "action":"cluster:admin/xpack/security/realm/cache/clear[n]", "request.name":"Node"} |
77 changes: 77 additions & 0 deletions
77
filebeat/module/elasticsearch/audit/test/test-audit-711.log-expected.json
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,77 @@ | ||
[ | ||
{ | ||
"@timestamp": "2019-09-05T16:02:37.921Z", | ||
"elasticsearch.audit.action": "indices:monitor/stats", | ||
"elasticsearch.audit.layer": "transport", | ||
"elasticsearch.audit.origin.type": "local_node", | ||
"elasticsearch.audit.realm": "__fallback", | ||
"elasticsearch.audit.request.id": "474ZciqtQteOhjLO3OdZIw", | ||
"elasticsearch.audit.request.name": "IndicesStatsRequest", | ||
"elasticsearch.node.id": "UwRu4mReRtyJO1-FWAPvIQ", | ||
"event.action": "authentication_success", | ||
"event.dataset": "elasticsearch.audit", | ||
"event.module": "elasticsearch", | ||
"event.timezone": "-02:00", | ||
"fileset.name": "audit", | ||
"input.type": "log", | ||
"log.offset": 0, | ||
"message": "{\"@timestamp\":\"2019-09-05T14:02:37,921\", \"node.id\":\"UwRu4mReRtyJO1-FWAPvIQ\", \"event.type\":\"transport\", \"event.action\":\"authentication_success\", \"user.name\":\"_system\", \"origin.type\":\"local_node\", \"origin.address\":\"127.0.0.1:9300\", \"realm\":\"__fallback\", \"request.id\":\"474ZciqtQteOhjLO3OdZIw\", \"action\":\"indices:monitor/stats\", \"request.name\":\"IndicesStatsRequest\"}", | ||
"service.type": "elasticsearch", | ||
"source.address": "127.0.0.1:9300", | ||
"source.ip": "127.0.0.1", | ||
"source.port": 9300, | ||
"user.name": "_system" | ||
}, | ||
{ | ||
"@timestamp": "2020-01-29T11:41:10.856Z", | ||
"elasticsearch.audit.action": "cluster:admin/xpack/security/realm/cache/clear", | ||
"elasticsearch.audit.layer": "transport", | ||
"elasticsearch.audit.origin.type": "local_node", | ||
"elasticsearch.audit.request.id": "I9bQCw28Qfe4HWtIJHgoAg", | ||
"elasticsearch.audit.request.name": "ClearRealmCacheRequest", | ||
"elasticsearch.audit.user.realm": "__attach", | ||
"elasticsearch.audit.user.roles": [ | ||
"superuser" | ||
], | ||
"elasticsearch.node.id": "DJKjhISiTzy-JY5nCU8h3Q", | ||
"event.action": "access_granted", | ||
"event.dataset": "elasticsearch.audit", | ||
"event.module": "elasticsearch", | ||
"event.timezone": "-02:00", | ||
"fileset.name": "audit", | ||
"input.type": "log", | ||
"log.offset": 363, | ||
"message": "{\"@timestamp\":\"2020-01-29T09:41:10,856\", \"node.id\":\"DJKjhISiTzy-JY5nCU8h3Q\", \"event.type\":\"transport\", \"event.action\":\"access_granted\", \"user.name\":\"_xpack_security\", \"user.realm\":\"__attach\", \"user.roles\":[\"superuser\"], \"origin.type\":\"local_node\", \"origin.address\":\"127.0.0.1:9300\", \"request.id\":\"I9bQCw28Qfe4HWtIJHgoAg\", \"action\":\"cluster:admin/xpack/security/realm/cache/clear\", \"request.name\":\"ClearRealmCacheRequest\"}", | ||
"service.type": "elasticsearch", | ||
"source.address": "127.0.0.1:9300", | ||
"source.ip": "127.0.0.1", | ||
"source.port": 9300, | ||
"user.name": "_xpack_security" | ||
}, | ||
{ | ||
"@timestamp": "2020-01-29T11:41:10.859Z", | ||
"elasticsearch.audit.action": "cluster:admin/xpack/security/realm/cache/clear[n]", | ||
"elasticsearch.audit.layer": "transport", | ||
"elasticsearch.audit.origin.type": "local_node", | ||
"elasticsearch.audit.request.id": "I9bQCw28Qfe4HWtIJHgoAg", | ||
"elasticsearch.audit.request.name": "Node", | ||
"elasticsearch.audit.user.realm": "__attach", | ||
"elasticsearch.audit.user.roles": [ | ||
"superuser" | ||
], | ||
"elasticsearch.node.id": "DJKjhISiTzy-JY5nCU8h3Q", | ||
"event.action": "access_granted", | ||
"event.dataset": "elasticsearch.audit", | ||
"event.module": "elasticsearch", | ||
"event.timezone": "-02:00", | ||
"fileset.name": "audit", | ||
"input.type": "log", | ||
"log.offset": 785, | ||
"message": "{\"@timestamp\":\"2020-01-29T09:41:10,859\", \"node.id\":\"DJKjhISiTzy-JY5nCU8h3Q\", \"event.type\":\"transport\", \"event.action\":\"access_granted\", \"user.name\":\"_xpack_security\", \"user.realm\":\"__attach\", \"user.roles\":[\"superuser\"], \"origin.type\":\"local_node\", \"origin.address\":\"127.0.0.1:9300\", \"request.id\":\"I9bQCw28Qfe4HWtIJHgoAg\", \"action\":\"cluster:admin/xpack/security/realm/cache/clear[n]\", \"request.name\":\"Node\"}", | ||
"service.type": "elasticsearch", | ||
"source.address": "127.0.0.1:9300", | ||
"source.ip": "127.0.0.1", | ||
"source.port": 9300, | ||
"user.name": "_xpack_security" | ||
} | ||
] |
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
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.
We add this processor for JSON logs as well because some versions of ES (e.g. 7.1.1) generate JSON audit logs with the
@timestamp
field which does not contain a time zone.Later versions of ES will generate JSON audit logs with a
timestamp
field which does contain the time zone. In such cases, we will remove theevent.timezone
field in the ingest pipeline to avoid confusion about which timezone is correct.Related: #13918.