kolla-ansible/ansible/roles/monasca/templates/monasca-log-transformer/log-transformer.conf.j2
Bartosz Bezak 17d8332604 Logstash 6 support
Co-Authored-By: Doug Szumski <doug@stackhpc.com>
Closes-Bug: #1884090
Depends-On: https://review.opendev.org/#/c/736768

Change-Id: If2d0dd1739e484b14e3c15a185a236918737b0ab
2020-07-15 08:54:53 +00:00

47 lines
1.5 KiB
Django/Jinja

# Provide input/output streams for transforming Monasca logs.
# Filters should be provided in other configuration files.
input {
kafka {
bootstrap_servers => "{{ monasca_kafka_servers }}"
topics => ["{{ monasca_raw_logs_topic }}"]
group_id => "log_transformer"
consumer_threads => "{{ monasca_log_pipeline_threads }}"
codec => json
}
}
filter {
# Update the timestamp of the event based on the time in the message.
date {
match => [ "[log][dimensions][timestamp]", "yyyy-MM-dd HH:mm:ss Z", "ISO8601"]
remove_field => [ "[log][dimensions][timestamp]", "[log][dimensions][Timestamp]" ]
}
# Monasca Log API adds a timestamp when it processes a log entry. This
# timestamp needs to be converted from seconds since the epoch for
# Elasticsearch to parse it correctly. Here we make that conversion.
date {
match => ["creation_time", "UNIX"]
target => "creation_time"
}
# OpenStack log levels are uppercase, and syslog are lowercase.
# Furthermore, syslog has more log levels that OpenStack. To avoid
# mapping syslog log levels to OpenStack log levels, we standardise
# on the syslog style here.
if [log][dimensions][log_level] {
mutate {
lowercase => [ "[log][dimensions][log_level]" ]
}
}
}
output {
kafka {
codec => json
bootstrap_servers => "{{ monasca_kafka_servers }}"
topic_id => "{{ monasca_transformed_logs_topic }}"
}
}