-
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
[Filebeat] Update handling of elasticsearch server logs #30018
Changes from all commits
9bb84b7
ccb7ad5
4dc1328
344352c
84bbaa5
4671444
bd320d8
df482e0
d0095f9
100ad26
455b4f9
feddd42
98df0c1
fc2b942
4e273db
7b8b5cb
57f77ef
91c2539
7fcd2b7
33e0a6f
aee4d57
9dc1124
adc7cf8
675403e
0923cd4
3b10008
1e1c940
8a2cc61
a254d7b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{"type":"audit", "timestamp":"2022-01-27T14:16:25,271+0100", "node.id":"O8SFUsk8QpGG16JVJcNgUw", "event.type":"transport", "event.action":"access_granted", "authentication.type":"REALM", "user.name":"elastic", "user.realm":"reserved", "user.roles":["superuser"], "origin.type":"rest", "origin.address":"[::1]:64583", "request.id":"yEUG-8deS2y8ZxGgeyeUnw", "action":"indices:admin/create", "request.name":"CreateIndexRequest", "indices":["test_1"], "opaque_id":"myApp1", "trace.id":"0af7651916cd43dd8448eb211c80319c"} | ||
{"type":"audit", "timestamp":"2022-01-27T14:16:28,601+0100", "node.id":"O8SFUsk8QpGG16JVJcNgUw", "event.type":"transport", "event.action":"access_granted", "authentication.type":"REALM", "user.name":"elastic", "user.realm":"reserved", "user.roles":["superuser"], "origin.type":"rest", "origin.address":"[::1]:64583", "request.id":"qo04VI2qRzKrE1dlrsjYgw", "action":"indices:admin/create", "request.name":"CreateIndexRequest", "indices":["test_2"]} | ||
{"type":"audit", "timestamp":"2022-01-27T14:16:30,950+0100", "node.id":"O8SFUsk8QpGG16JVJcNgUw", "event.type":"rest", "event.action":"anonymous_access_denied", "origin.type":"rest", "origin.address":"[::1]:64583", "url.path":"/test_3", "request.method":"PUT", "request.id":"0ybRdKGYRAekov1eKI6nIw", "opaque_id":"myApp1", "trace.id":"0af7651916cd43dd8448eb211c80319c"} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
[ | ||
{ | ||
"@timestamp": "2022-01-27T13:16:25.271Z", | ||
"elasticsearch.audit.action": "indices:admin/create", | ||
"elasticsearch.audit.authentication.type": "REALM", | ||
"elasticsearch.audit.indices": [ | ||
"test_1" | ||
], | ||
"elasticsearch.audit.layer": "transport", | ||
"elasticsearch.audit.opaque_id": "myApp1", | ||
"elasticsearch.audit.origin.type": "rest", | ||
"elasticsearch.audit.request.id": "yEUG-8deS2y8ZxGgeyeUnw", | ||
"elasticsearch.audit.request.name": "CreateIndexRequest", | ||
"elasticsearch.audit.user.realm": "reserved", | ||
"elasticsearch.audit.user.roles": [ | ||
"superuser" | ||
], | ||
"elasticsearch.node.id": "O8SFUsk8QpGG16JVJcNgUw", | ||
"event.action": "access_granted", | ||
"event.category": "database", | ||
"event.dataset": "elasticsearch.audit", | ||
"event.kind": "event", | ||
"event.module": "elasticsearch", | ||
"event.outcome": "success", | ||
"fileset.name": "audit", | ||
"host.id": "O8SFUsk8QpGG16JVJcNgUw", | ||
"http.request.id": "yEUG-8deS2y8ZxGgeyeUnw", | ||
"input.type": "log", | ||
"log.offset": 0, | ||
"message": "{\"type\":\"audit\", \"timestamp\":\"2022-01-27T14:16:25,271+0100\", \"node.id\":\"O8SFUsk8QpGG16JVJcNgUw\", \"event.type\":\"transport\", \"event.action\":\"access_granted\", \"authentication.type\":\"REALM\", \"user.name\":\"elastic\", \"user.realm\":\"reserved\", \"user.roles\":[\"superuser\"], \"origin.type\":\"rest\", \"origin.address\":\"[::1]:64583\", \"request.id\":\"yEUG-8deS2y8ZxGgeyeUnw\", \"action\":\"indices:admin/create\", \"request.name\":\"CreateIndexRequest\", \"indices\":[\"test_1\"], \"opaque_id\":\"myApp1\", \"trace.id\":\"0af7651916cd43dd8448eb211c80319c\"}", | ||
"related.user": [ | ||
"elastic" | ||
], | ||
"service.type": "elasticsearch", | ||
"source.address": "[::1]:64583", | ||
"source.ip": "::1", | ||
"source.port": 64583, | ||
"trace.id": "0af7651916cd43dd8448eb211c80319c", | ||
"user.name": "elastic" | ||
}, | ||
{ | ||
"@timestamp": "2022-01-27T13:16:28.601Z", | ||
"elasticsearch.audit.action": "indices:admin/create", | ||
"elasticsearch.audit.authentication.type": "REALM", | ||
"elasticsearch.audit.indices": [ | ||
"test_2" | ||
], | ||
"elasticsearch.audit.layer": "transport", | ||
"elasticsearch.audit.origin.type": "rest", | ||
"elasticsearch.audit.request.id": "qo04VI2qRzKrE1dlrsjYgw", | ||
"elasticsearch.audit.request.name": "CreateIndexRequest", | ||
"elasticsearch.audit.user.realm": "reserved", | ||
"elasticsearch.audit.user.roles": [ | ||
"superuser" | ||
], | ||
"elasticsearch.node.id": "O8SFUsk8QpGG16JVJcNgUw", | ||
"event.action": "access_granted", | ||
"event.category": "database", | ||
"event.dataset": "elasticsearch.audit", | ||
"event.kind": "event", | ||
"event.module": "elasticsearch", | ||
"event.outcome": "success", | ||
"fileset.name": "audit", | ||
"host.id": "O8SFUsk8QpGG16JVJcNgUw", | ||
"http.request.id": "qo04VI2qRzKrE1dlrsjYgw", | ||
"input.type": "log", | ||
"log.offset": 517, | ||
"message": "{\"type\":\"audit\", \"timestamp\":\"2022-01-27T14:16:28,601+0100\", \"node.id\":\"O8SFUsk8QpGG16JVJcNgUw\", \"event.type\":\"transport\", \"event.action\":\"access_granted\", \"authentication.type\":\"REALM\", \"user.name\":\"elastic\", \"user.realm\":\"reserved\", \"user.roles\":[\"superuser\"], \"origin.type\":\"rest\", \"origin.address\":\"[::1]:64583\", \"request.id\":\"qo04VI2qRzKrE1dlrsjYgw\", \"action\":\"indices:admin/create\", \"request.name\":\"CreateIndexRequest\", \"indices\":[\"test_2\"]}", | ||
"related.user": [ | ||
"elastic" | ||
], | ||
"service.type": "elasticsearch", | ||
"source.address": "[::1]:64583", | ||
"source.ip": "::1", | ||
"source.port": 64583, | ||
"user.name": "elastic" | ||
}, | ||
{ | ||
"@timestamp": "2022-01-27T13:16:30.950Z", | ||
"elasticsearch.audit.layer": "rest", | ||
"elasticsearch.audit.opaque_id": "myApp1", | ||
"elasticsearch.audit.origin.type": "rest", | ||
"elasticsearch.audit.request.id": "0ybRdKGYRAekov1eKI6nIw", | ||
"elasticsearch.node.id": "O8SFUsk8QpGG16JVJcNgUw", | ||
"event.action": "anonymous_access_denied", | ||
"event.category": "database", | ||
"event.dataset": "elasticsearch.audit", | ||
"event.kind": "event", | ||
"event.module": "elasticsearch", | ||
"event.outcome": "failure", | ||
"fileset.name": "audit", | ||
"host.id": "O8SFUsk8QpGG16JVJcNgUw", | ||
"http.request.id": "0ybRdKGYRAekov1eKI6nIw", | ||
"http.request.method": "PUT", | ||
"input.type": "log", | ||
"log.offset": 965, | ||
"message": "{\"type\":\"audit\", \"timestamp\":\"2022-01-27T14:16:30,950+0100\", \"node.id\":\"O8SFUsk8QpGG16JVJcNgUw\", \"event.type\":\"rest\", \"event.action\":\"anonymous_access_denied\", \"origin.type\":\"rest\", \"origin.address\":\"[::1]:64583\", \"url.path\":\"/test_3\", \"request.method\":\"PUT\", \"request.id\":\"0ybRdKGYRAekov1eKI6nIw\", \"opaque_id\":\"myApp1\", \"trace.id\":\"0af7651916cd43dd8448eb211c80319c\"}", | ||
"service.type": "elasticsearch", | ||
"source.address": "[::1]:64583", | ||
"source.ip": "::1", | ||
"source.port": 64583, | ||
"trace.id": "0af7651916cd43dd8448eb211c80319c", | ||
"url.original": "/test_3" | ||
} | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
description: Pipeline for parsing the Elasticsearch deprecation log file in JSON format. | ||
on_failure: | ||
- set: | ||
field: error.message | ||
value: '{{ _ingest.on_failure_message }}' | ||
processors: | ||
- json: | ||
field: message | ||
target_field: elasticsearch.deprecation | ||
- drop: | ||
if: '!["deprecation", "deprecation.elasticsearch"].contains(ctx.elasticsearch.deprecation.type)' | ||
- remove: | ||
field: elasticsearch.deprecation.type | ||
- dot_expander: | ||
field: service.name | ||
path: elasticsearch.deprecation | ||
- rename: | ||
field: elasticsearch.deprecation.service.name | ||
target_field: service.name | ||
ignore_missing: true | ||
- rename: | ||
field: elasticsearch.deprecation.level | ||
target_field: log.level | ||
ignore_missing: true | ||
- dot_expander: | ||
field: log.level | ||
path: elasticsearch.deprecation | ||
- rename: | ||
field: elasticsearch.deprecation.log.level | ||
target_field: log.level | ||
ignore_missing: true | ||
- dot_expander: | ||
field: log.logger | ||
path: elasticsearch.deprecation | ||
- rename: | ||
field: elasticsearch.deprecation.log.logger | ||
target_field: log.logger | ||
ignore_missing: true | ||
- dot_expander: | ||
field: process.thread.name | ||
path: elasticsearch.deprecation | ||
- rename: | ||
field: elasticsearch.deprecation.process.thread.name | ||
target_field: process.thread.name | ||
ignore_missing: true | ||
- rename: | ||
field: elasticsearch.deprecation.component | ||
target_field: elasticsearch.component | ||
ignore_missing: true | ||
- dot_expander: | ||
field: cluster.name | ||
path: elasticsearch.deprecation | ||
- rename: | ||
field: elasticsearch.deprecation.cluster.name | ||
target_field: elasticsearch.cluster.name | ||
- dot_expander: | ||
field: node.name | ||
path: elasticsearch.deprecation | ||
- rename: | ||
field: elasticsearch.deprecation.node.name | ||
target_field: elasticsearch.node.name | ||
- dot_expander: | ||
field: cluster.uuid | ||
path: elasticsearch.deprecation | ||
- rename: | ||
field: elasticsearch.deprecation.cluster.uuid | ||
target_field: elasticsearch.cluster.uuid | ||
ignore_missing: true | ||
- dot_expander: | ||
field: node.id | ||
path: elasticsearch.deprecation | ||
- rename: | ||
field: elasticsearch.deprecation.node.id | ||
target_field: elasticsearch.node.id | ||
ignore_missing: true | ||
- remove: | ||
field: message | ||
- rename: | ||
field: elasticsearch.deprecation.message | ||
target_field: message | ||
- date: | ||
field: 'elasticsearch.deprecation.@timestamp' | ||
formats: | ||
- ISO8601 | ||
ignore_failure: true | ||
if: 'ctx.elasticsearch?.deprecation["@timestamp"] != null' | ||
- date: | ||
field: 'elasticsearch.deprecation.timestamp' | ||
formats: | ||
- ISO8601 | ||
ignore_failure: true | ||
if: 'ctx.elasticsearch?.deprecation?.timestamp != null' | ||
- remove: | ||
field: | ||
- elasticsearch.deprecation.timestamp | ||
- elasticsearch.deprecation.@timestamp | ||
ignore_missing: true |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
description: Pipeline for parsing the Elasticsearch deprecation log file in JSON format. | ||
on_failure: | ||
- set: | ||
field: error.message | ||
value: '{{ _ingest.on_failure_message }}' | ||
processors: | ||
- json: | ||
field: message | ||
add_to_root: true | ||
- dot_expander: | ||
field: '*' | ||
override: true | ||
- set: | ||
field: event.dataset | ||
value: elasticsearch.deprecation | ||
Comment on lines
+13
to
+15
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Elasticsearch currently produces an inconsistent dataset for deprecation logs which has the product and type reversed (ie There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @klacabane Create a followup issue for this change. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think there was some intention around this elastic/elasticsearch#68737 but lets not hold off this PR on this and follow up on it. |
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 don't think we should be adding these to the documentation. Maybe @pgomulka can confirm but fields that don't have the
elasticsearch.
prefix appear to be all ecs fields (for example this one is https://www.elastic.co/guide/en/ecs/current/ecs-event.html#field-event-dataset)We can lift the field up to the root of the document to avoid having to document them here.
This comment was marked as outdated.
Sorry, something went wrong.
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, as mentioned in other comments. Logs emitted by ES8 are ECS and don't need to be renamed. Could be just attached to the root of the document.
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.
actually @ruflin 's idea might work even better. Just use add_to_root+dot_expander and you can avoid a lot of the remapping I think. Check out slowlog/ingest/pipeline-json-8.yml