-
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.
[Filebeat] Add RabbitMQ module (#12032)
* Parses single and multiline messages from [RabbitMQ's unified log file](https://www.rabbitmq.com/logging.html#log-file-location) * `var.paths` uses the `RABBITMQ_LOGS` env variable if present * `var.convert_timezone` (enabled by default since the [timestamps are localtime by default](https://github.com/erlang-lager/lager#universal-time)) * No dashboard * Tested with ``` ~/go/src/github.com/elastic/beats/x-pack/filebeat [master @ 092a3f5] ✓ ‣ MODULES_PATH=./module GENERATE=1 INTEGRATION_TESTS=1 TESTING_FILEBEAT_MODULES=rabbitmq nosetests tests/system/test_xpack_modules.py -v test_fileset_file_0_rabbitmq (test_xpack_modules.XPackTest) ... ok ---------------------------------------------------------------------- Ran 1 test in 3.320s OK ```
- Loading branch information
John Schulz
authored
May 16, 2019
1 parent
f549cec
commit b5c92a7
Showing
18 changed files
with
764 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
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,72 @@ | ||
//// | ||
This file is generated! See scripts/docs_collector.py | ||
//// | ||
|
||
[[filebeat-module-rabbitmq]] | ||
:modulename: rabbitmq | ||
:has-dashboards: false | ||
|
||
== RabbitMQ module | ||
|
||
This is the module for parsing https://www.rabbitmq.com/logging.html[RabbitMQ log files] | ||
|
||
include::../include/what-happens.asciidoc[] | ||
|
||
[float] | ||
=== Compatibility | ||
|
||
Parses https://www.rabbitmq.com/logging.html[single file format] introduced in 3.7.0. | ||
|
||
Tested with version 3.7.14. | ||
|
||
include::../include/running-modules.asciidoc[] | ||
|
||
include::../include/configuring-intro.asciidoc[] | ||
|
||
The following example shows how to set paths in the +modules.d/{modulename}.yml+ | ||
file to override the default paths for RabbitMQ logs: | ||
|
||
|
||
["source","yaml",subs="attributes"] | ||
----- | ||
- module: rabbitmq | ||
log: | ||
enabled: true | ||
var.paths: ["/path/to/log/rabbitmq/*.log*"] | ||
----- | ||
|
||
|
||
To specify the same settings at the command line, you use: | ||
|
||
["source","sh",subs="attributes"] | ||
----- | ||
-M "rabbitmq.log.var.paths=[/path/to/log/rabbitmq/*.log*]" | ||
----- | ||
|
||
:fileset_ex: log | ||
|
||
include::../include/config-option-intro.asciidoc[] | ||
|
||
[float] | ||
==== `log` fileset settings | ||
|
||
include::../include/var-paths.asciidoc[] | ||
|
||
:default_convert_timezone: true | ||
|
||
include::../include/var-convert-timezone.asciidoc[] | ||
|
||
:has-dashboards!: | ||
|
||
:fileset_ex!: | ||
:default_convert_timezone!: | ||
|
||
:modulename!: | ||
|
||
|
||
[float] | ||
=== Fields | ||
|
||
For a description of each field in the module, see the | ||
<<exported-fields-rabbitmq,exported fields>> section. | ||
|
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,11 @@ | ||
#- module: rabbitmq | ||
# All logs | ||
#log: | ||
#enabled: true | ||
|
||
# Set custom paths for the log files. If left empty, | ||
# Filebeat will choose the paths depending on your OS. | ||
#var.paths: ["/var/log/rabbitmq/rabbit@localhost.log*"] | ||
|
||
# Convert the timestamp to UTC. Requires Elasticsearch >= 6.1. | ||
#var.convert_timezone: false |
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,59 @@ | ||
:modulename: rabbitmq | ||
:has-dashboards: false | ||
|
||
== RabbitMQ module | ||
|
||
This is the module for parsing https://www.rabbitmq.com/logging.html[RabbitMQ log files] | ||
|
||
include::../include/what-happens.asciidoc[] | ||
|
||
[float] | ||
=== Compatibility | ||
|
||
Parses https://www.rabbitmq.com/logging.html[single file format] introduced in 3.7.0. | ||
|
||
Tested with version 3.7.14. | ||
|
||
include::../include/running-modules.asciidoc[] | ||
|
||
include::../include/configuring-intro.asciidoc[] | ||
|
||
The following example shows how to set paths in the +modules.d/{modulename}.yml+ | ||
file to override the default paths for RabbitMQ logs: | ||
|
||
|
||
["source","yaml",subs="attributes"] | ||
----- | ||
- module: rabbitmq | ||
log: | ||
enabled: true | ||
var.paths: ["/path/to/log/rabbitmq/*.log*"] | ||
----- | ||
|
||
|
||
To specify the same settings at the command line, you use: | ||
|
||
["source","sh",subs="attributes"] | ||
----- | ||
-M "rabbitmq.log.var.paths=[/path/to/log/rabbitmq/*.log*]" | ||
----- | ||
|
||
:fileset_ex: log | ||
|
||
include::../include/config-option-intro.asciidoc[] | ||
|
||
[float] | ||
==== `log` fileset settings | ||
|
||
include::../include/var-paths.asciidoc[] | ||
|
||
:default_convert_timezone: true | ||
|
||
include::../include/var-convert-timezone.asciidoc[] | ||
|
||
:has-dashboards!: | ||
|
||
:fileset_ex!: | ||
:default_convert_timezone!: | ||
|
||
:modulename!: |
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,9 @@ | ||
- key: rabbitmq | ||
title: "RabbitMQ" | ||
description: > | ||
RabbitMQ Module | ||
fields: | ||
- name: rabbitmq | ||
type: group | ||
description: > | ||
fields: |
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,9 @@ | ||
- name: log | ||
type: group | ||
description: > | ||
RabbitMQ log files | ||
fields: | ||
- name: pid | ||
type: keyword | ||
description: The Erlang process id | ||
example: <0.222.0> |
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,19 @@ | ||
type: log | ||
paths: | ||
{{ range $i, $path := .paths }} | ||
- {{$path}} | ||
{{ end }} | ||
exclude_files: [".gz$"] | ||
|
||
# If the line doesn't start with a timestamp, consider it a continuation of the previous line | ||
# From https://www.elastic.co/guide/en/beats/filebeat/current/_examples_of_multiline_configuration.html#_timestamps | ||
# ideally, this would be the same pattern (`DATESTAMP`) used in `processors.grok.patterns` | ||
multiline: | ||
pattern: '[0-9]{4}-[0-9]{2}-[0-9]{2}' | ||
negate: true | ||
match: after | ||
|
||
processors: | ||
{{ if .convert_timezone }} | ||
- add_locale: ~ | ||
{{ end }} |
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,28 @@ | ||
--- | ||
description: Pipeline for parsing RabbitMQ logs | ||
processors: | ||
- grok: | ||
field: message | ||
pattern_definitions: | ||
GREEDYMULTILINE: "(.|\n)*" | ||
ERL_PID: "\\<%{INT}+\\.%{INT}+\\.%{INT}+\\>" | ||
patterns: | ||
- "%{DATESTAMP:timestamp} \\[%{WORD:log.level}\\] %{ERL_PID:rabbitmq.log.pid} | ||
%{GREEDYMULTILINE:message}" | ||
ignore_missing: true | ||
- date: | ||
field: timestamp | ||
target_field: "@timestamp" | ||
formats: | ||
- yy-MM-dd HH:mm:ss.SSS | ||
ignore_failure: true | ||
#{< if .convert_timezone >} | ||
timezone: "{{ event.timezone }}" | ||
#{< end >} | ||
- remove: | ||
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,19 @@ | ||
module_version: 1.0 | ||
|
||
var: | ||
- name: paths | ||
default: | ||
- ${RABBITMQ_LOGS:/var/log/rabbitmq/rabbit@localhost.log*} | ||
os.darwin: | ||
- ${RABBITMQ_LOGS:/usr/local/var/log/rabbitmq/rabbit@localhost.log*} | ||
os.windows: | ||
#- '%APPDATA%\RabbitMQ\log\rabbit@localhost.log*' | ||
- name: convert_timezone | ||
default: true | ||
# if ES < 6.1.0, this flag switches to false automatically when evaluating the | ||
# pipeline | ||
min_elasticsearch_version: | ||
version: 6.1.0 | ||
value: false | ||
ingest_pipeline: ingest/pipeline.yml | ||
input: config/log.yml |
Oops, something went wrong.