Add logstash files for log parsing

This commit provides a couple of template files to be used with logstash
for parsing log files generated by the rug.  As provided, these files
will attempt to send metrics to graphite, but should prove useful as a
basis for other rug related logstash activities.

Change-Id: Ie3ab18c2b8bfd9765f066bcf34c5f572956b3f72
This commit is contained in:
David Wahlstrom 2016-02-26 11:14:07 -08:00 committed by David Wahlstrom
parent 3931784e07
commit 98c90a0a53
3 changed files with 46 additions and 0 deletions

3
tools/logstash/README.md Normal file
View File

@ -0,0 +1,3 @@
These files are used for logstash to read the astara-orchestrator log and send
metrics to a graphite server. Logstash has many output options, so these files
serve as a template for parsing the astara-orchestrator log file.

View File

@ -0,0 +1,4 @@
WORKER p[0-9][0-9]
THREAD tmain|t[0-9][0-9]
ASTARA_STATE_METHOD (?:[a-zA-Z]*\.)*
METHOD (?:astara.openstack.common.rpc.amqp|astara.worker|astara.api.configuration|astara.tenant|astara.state.|astara.scheduler)

View File

@ -0,0 +1,39 @@
input {
file {
path => '/var/log/akrug/akrug.log'
}
}
filter {
grok {
patterns_dir => "/etc/logstash/patterns/logstash-rug-patterns"
match => {"message" => "%{TIMESTAMP_ISO8601:akanda_timestamp}:%{LOGLEVEL:loglevel}:%{ASTARA_STATE_METHOD:method}%{UUID:router_id}:%{POSINT:pid}:%{WORKER:worker}:%{THREAD:thread}:incoming message brings queue length to %{INT:queue_length}"}
add_tag => [ "queue_length" ]
}
grok {
patterns_dir => "/etc/logstash/patterns/logstash-rug-patterns"
match => {"message" => "%{TIMESTAMP_ISO8601:akanda_timestamp}:%{LOGLEVEL:loglevel}:%{METHOD:method}:%{POSINT:pid}:%{WORKER:worker}:%{THREAD:thread}"}
add_tag => [ "threads" ]
}
date {
match => [ "akanda_timestamp", "YYYY-MM-dd HH:mm:ss" ]
}
}
output {
if "queue_length" in [tags] {
graphite {
host => "127.0.0.1"
metrics => { "%{router_id}/queue_length" => "%{queue_length}" }
metrics_format => "openstack.astara.rug.routers.*"
}
} else if "threads" in [tags] {
graphite {
host => "127.0.0.1"
metrics => { "%{worker}/%{thread}" => "1" }
metrics_format => "openstack.astara.rug.workers.*"
}
}
}