-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Slowlog fileset for the Elasticsearch module (#7473)
This is the initial PR for slowlog indexing.
- Loading branch information
Showing
12 changed files
with
393 additions
and
1 deletion.
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
Large diffs are not rendered by default.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
- name: slowlog | ||
description: "Slowlog events from Elasticsearch" | ||
example: "[2018-06-29T10:06:14,933][INFO ][index.search.slowlog.query] [v_VJhjV] [metricbeat-6.3.0-2018.06.26][0] took[4.5ms], took_millis[4], total_hits[19435], types[], stats[], search_type[QUERY_THEN_FETCH], total_shards[1], source[{\"query\":{\"match_all\":{\"boost\":1.0}}}]," | ||
type: group | ||
fields: | ||
- name: loglevel | ||
description: "Log level" | ||
example: "INFO" | ||
type: keyword | ||
- name: logger | ||
description: "Logger name" | ||
example: "index.search.slowlog.fetch" | ||
type: keyword | ||
- name: node_name | ||
description: "Name of the node" | ||
example: "v_VJhjV" | ||
type: keyword | ||
- name: index_name | ||
description: "Name of the index" | ||
example: "metricbeat-6.3.0-2018.06.26" | ||
type: keyword | ||
- name: shard_id | ||
description: "Id of the shard" | ||
example: "0" | ||
type: keyword | ||
- name: took | ||
description: "Time it took to execute the query" | ||
example: "300ms" | ||
type: text | ||
- name: types | ||
description: "Types" | ||
example: "" | ||
type: keyword | ||
- name: stats | ||
description: "Statistics" | ||
example: "" | ||
type: text | ||
- name: search_type | ||
description: Please add description | ||
example: "QUERY_THEN_FETCH" | ||
type: keyword | ||
- name: source_query | ||
description: "Slow query" | ||
example: "{\"query\":{\"match_all\":{\"boost\":1.0}}}" | ||
type: text | ||
- name: extra_source | ||
description: "Extra source information" | ||
example: "" | ||
type: text | ||
- name: took_millis | ||
description: "Time took in milliseconds" | ||
example: 42 | ||
type: keyword | ||
- name: total_hits | ||
description: "Total hits" | ||
example: 42 | ||
type: keyword | ||
- name: total_shards | ||
description: "Total queried shards" | ||
example: 22 | ||
type: keyword |
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,10 @@ | ||
type: log | ||
paths: | ||
{{ range $i, $path := .paths }} | ||
- {{$path}} | ||
{{ end }} | ||
exclude_files: [".gz$"] | ||
|
||
fields: | ||
service.name: "elasticsearch" | ||
fields_under_root: true |
31 changes: 31 additions & 0 deletions
31
filebeat/module/elasticsearch/slowlog/ingest/pipeline.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,31 @@ | ||
{ | ||
"description": "Pipeline for parsing elasticsearch slowlog logs", | ||
"processors": [ | ||
{ | ||
"rename": { | ||
"field": "@timestamp", | ||
"target_field": "event.created" | ||
} | ||
}, | ||
{ | ||
"grok": { | ||
"field": "message", | ||
"patterns": [ | ||
"\\[%{TIMESTAMP_ISO8601:elasticsearch.slowlog.timestamp}\\]\\[%{WORD:elasticsearch.slowlog.loglevel}(\\s*)?\\](\\s*)?\\[%{DATA:elasticsearch.slowlog.logger}\\]\\s*\\[%{WORD:elasticsearch.slowlog.node_name}\\]\\s*\\[%{DATA:elasticsearch.slowlog.index_name}\\]\\[%{DATA:elasticsearch.slowlog.shard_id}\\]\\s*took\\[%{DATA:elasticsearch.slowlog.took}\\],\\s*took_millis\\[%{NUMBER:elasticsearch.slowlog.took_millis:int}\\],\\s*total_hits\\[%{NUMBER:elasticsearch.slowlog.total_hits:int}\\],\\s*types\\[%{DATA:elasticsearch.slowlog.types}\\],\\s*stats\\[%{DATA:elasticsearch.slowlog.stats}\\],\\s*search_type\\[%{DATA:elasticsearch.slowlog.search_type}\\],\\s*total_shards\\[%{NUMBER:elasticsearch.slowlog.total_shards:int}\\],\\s*source\\[%{GREEDYDATA:elasticsearch.slowlog.source_query}\\],(\\s*)?(extra_source\\[%{DATA:elasticsearch.slowlog.extra_source}\\])?,?" | ||
] | ||
} | ||
}, | ||
{ | ||
"rename": { | ||
"field": "elasticsearch.slowlog.timestamp", | ||
"target_field": "@timestamp" | ||
} | ||
} | ||
], | ||
"on_failure" : [{ | ||
"set" : { | ||
"field" : "error.message", | ||
"value" : "{{ _ingest.on_failure_message }}" | ||
} | ||
}] | ||
} |
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,13 @@ | ||
module_version: 1.0 | ||
|
||
var: | ||
- name: paths | ||
default: | ||
- /var/log/elasticsearch/*_index_search_slowlog.log | ||
os.darwin: | ||
- /usr/local/elasticsearch/*_index_search_slowlog.log | ||
os.windows: | ||
- c:/ProgramData/Elastic/Elasticsearch/logs/*_index_search_slowlog.log | ||
|
||
ingest_pipeline: ingest/pipeline.json | ||
input: config/slowlog.yml |
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,4 @@ | ||
[2018-06-29T10:06:14,933][INFO ][index.search.slowlog.query] [v_VJhjV] [metricbeat-6.3.0-2018.06.26][0] took[4.5ms], took_millis[4], total_hits[19435], types[], stats[], search_type[QUERY_THEN_FETCH], total_shards[1], source[{"query":{"match_all":{"boost":1.0}}}], | ||
[2018-06-29T10:06:14,943][INFO ][index.search.slowlog.fetch] [v_VJhjV] [metricbeat-6.3.0-2018.06.26][0] took[10.8ms], took_millis[10], total_hits[19435], types[], stats[], search_type[QUERY_THEN_FETCH], total_shards[1], source[{"query":{"match_all":{"boost":1.0}}}], | ||
[2018-06-29T09:01:01,821][INFO ][index.search.slowlog.query] [v_VJhjV] [metricbeat-6.3.0-2018.06.26][0] took[124.3ms], took_millis[124], total_hits[0], types[], stats[], search_type[QUERY_THEN_FETCH], total_shards[1], source[{"size":500,"query":{"match_none":{"boost":1.0}},"version":true,"_source":{"includes":[],"excludes":[]},"stored_fields":"*","docvalue_fields":["@timestamp","ceph.monitor_health.last_updated","docker.container.created","docker.healthcheck.event.end_date","docker.healthcheck.event.start_date","docker.image.created","kubernetes.container.start_time","kubernetes.event.metadata.timestamp.created","kubernetes.node.start_time","kubernetes.pod.start_time","kubernetes.system.start_time","mongodb.status.background_flushing.last_finished","mongodb.status.local_time","php_fpm.pool.start_time","postgresql.activity.backend_start","postgresql.activity.query_start","postgresql.activity.state_change","postgresql.activity.transaction_start","postgresql.bgwriter.stats_reset","postgresql.database.stats_reset","system.process.cpu.start_time"],"script_fields":{},"sort":[{"@timestamp":{"order":"desc","unmapped_type":"boolean"}}],"aggregations":{"2":{"date_histogram":{"field":"@timestamp","time_zone":"Europe/Berlin","interval":"30s","offset":0,"order":{"_key":"asc"},"keyed":false,"min_doc_count":1}}},"highlight":{"pre_tags":["@kibana-highlighted-field@"],"post_tags":["@/kibana-highlighted-field@"],"fragment_size":2147483647,"fields":{"*":{}}}}], | ||
[2018-06-29T09:01:01,827][INFO ][index.search.slowlog.fetch] [v_VJhjV] [metricbeat-6.3.0-2018.06.26][0] took[7.2ms], took_millis[7], total_hits[0], types[], stats[], search_type[QUERY_THEN_FETCH], total_shards[1], source[{"size":500,"query":{"match_none":{"boost":1.0}},"version":true,"_source":{"includes":[],"excludes":[]},"stored_fields":"*","docvalue_fields":["@timestamp","ceph.monitor_health.last_updated","docker.container.created","docker.healthcheck.event.end_date","docker.healthcheck.event.start_date","docker.image.created","kubernetes.container.start_time","kubernetes.event.metadata.timestamp.created","kubernetes.node.start_time","kubernetes.pod.start_time","kubernetes.system.start_time","mongodb.status.background_flushing.last_finished","mongodb.status.local_time","php_fpm.pool.start_time","postgresql.activity.backend_start","postgresql.activity.query_start","postgresql.activity.state_change","postgresql.activity.transaction_start","postgresql.bgwriter.stats_reset","postgresql.database.stats_reset","system.process.cpu.start_time"],"script_fields":{},"sort":[{"@timestamp":{"order":"desc","unmapped_type":"boolean"}}],"aggregations":{"2":{"date_histogram":{"field":"@timestamp","time_zone":"Europe/Berlin","interval":"30s","offset":0,"order":{"_key":"asc"},"keyed":false,"min_doc_count":1}}},"highlight":{"pre_tags":["@kibana-highlighted-field@"],"post_tags":["@/kibana-highlighted-field@"],"fragment_size":2147483647,"fields":{"*":{}}}}], |
Oops, something went wrong.