Skip to content
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

Add format for RabbitMQ logs #870

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/formats/formats.am
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ FORMAT_FILES = \
$(srcdir)/%reldir%/openstack_log.json \
$(srcdir)/%reldir%/page_log.json \
$(srcdir)/%reldir%/papertrail_log.json \
$(srcdir)/%reldir%/rabbitmq_log.json \
$(srcdir)/%reldir%/snaplogic_log.json \
$(srcdir)/%reldir%/sssd_log.json \
$(srcdir)/%reldir%/strace_log.json \
Expand Down
46 changes: 46 additions & 0 deletions src/formats/rabbitmq_log.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"$schema": "https://lnav.org/schemas/format-v1.schema.json",
"rabbitmq_log": {
"regex": {
"connection": {
"pattern" : "^=(?<level>[A-Z]+) REPORT==== (?<timestamp>\\d\\d?-\\w{3}-\\d{4}::\\d{2}:\\d{2}:\\d{2}) ===(\\n(?<body>(closing AMQP connection <(?<stuff>.+)> \\((?<sourceIP>\\d[\\d.]+\\d?):(?<sourcePort>\\d+) -> (?<destIP>\\d[\\d.]+\\d?):(?<destPort>\\d+)\\))?(.*\\n)*))?$"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if the performance issue could be mitigated by tweaking this a bit. For example changing the .+ inside <(?<stuff>.+)> to [^>]+ so that the regexp matching engine doesn't have to do any backtracking. Just a guess, not sure if it will help!

}
},
"timestamp-format" : ["%e-%b-%Y::%H:%M:%S"],
"level": {
"error": "ERROR",
"warning": "WARNING|SUPERVISOR",
"info": "INFO|PROGRESS",
"fatal": "CRASH"
},
"value" : {
"body" : {
"kind" : "string",
"identifier" : true
},
"sourceIP" : {
"kind" : "string",
"identifier" : true,
"collate" : "ipaddress"
},
"sourcePort" : {
"kind" : "integer",
"identifier" : true
},
"destIP" : {
"kind" : "string",
"identifier" : true,
"collate" : "ipaddress"
},
"destPort" : {
"kind" : "integer",
"identifier" : true
}
},
"sample": [
{
"line": "=ERROR REPORT==== 21-Apr-2016::21:19:01 ===\n** Node 'rabbit@red-hound-01' not responding **\n** Removing (timedout) connection **\n\n"
}
]
}
}