Doug Szumski 0743a9bf4b Remove Monasca Log Transformer
Historically Monasca Log Transformer has been for log
standardisation and processing. For example, logs from different
sources may use slightly different error levels such as WARN, 5,
or WARNING. Monasca Log Transformer is a place where these could
be 'squashed' into a single error level to simplify log searches
based on labels such as these.

However, in Kolla Ansible, we do this processing in Fluentd so
that the simpler Fluentd -> Elastic -> Kibana pipeline also
benefits. This helps to avoid spreading out log parsing
configuration over many services, with the Fluentd Monasca output
plugin being yet another potential place for processing (which
should be avoided). It therefore makes sense to remove this
service entirely, and squash any existing configuration which
can't be moved to Fluentd into the Log Perister service. I.e.
by removing this pipeline, we don't loose any functionality,
we encourage log processing to take place in Fluentd, or at least
outside of Monasca, and we make significant gains in efficiency
by removing a topic from Kafka which contains a copy of all logs
in transit.

Finally, users forwarding logs from outside the control plane,
eg. from tenant instances, should be encouraged to process the
logs at the point of sending using whichever framework they are
forwarding them with. This makes sense, because all Logstash
configuration in Monasca is only accessible by control plane
admins. A user can't typically do any processing inside Monasca,
with or without this change.

Change-Id: I65c76d0d1cd488725e4233b7e75a11d03866095c
2021-03-03 17:20:18 +00:00

76 lines
2.9 KiB
Django/Jinja

# This config file is used to generate Monasca metrics from logs ingested
# by the Monasca Log API. Alarms and notifications can then be set to alert
# users when a particular log message is ingested. This example config file
# generates metrics for all logs which have a log level which isn't
# debug, trace or info level. A user may want to apply additional logic to
# generate special metrics when particular log messages are ingested. For
# example, if HAProxy fails over, file system corruption is detected or
# other scenarios of interest.
input {
kafka {
bootstrap_servers => "{{ monasca_kafka_servers }}"
topics => ["{{ monasca_raw_logs_topic }}"]
group_id => "log_metrics"
consumer_threads => "{{ monasca_log_pipeline_threads }}"
codec => json
}
}
filter {
# Drop everything we don't want to create metrics for.
if ![log][dimensions][log_level] or [log][dimensions][log_level] in [ "debug", "trace", "info", "notice", "note" ] {
drop {
}
}
# Generate a metric name based on the program and log level
mutate {
add_field => { "[metric][name]" => "log.%{[log][dimensions][programname]}.%{[log][dimensions][log_level]}" }
}
# Form the metric structure.
mutate {
add_field => { "[metric][value]" => 1 }
rename => { "[log][dimensions]" => "[metric][dimensions]" }
rename => { "[metric][dimensions][Hostname]" => "[metric][dimensions][hostname]" }
rename => { "[metric][dimensions][programname]" => "[metric][dimensions][service]" }
}
mutate {
convert => { "[metric][value]" => "float" }
}
# Convert the timestamp of the event to milliseconds since epoch.
ruby {
code => "event.set('[metric][timestamp]', event.get('[@timestamp]').to_i*1000)"
}
# Clean up any fields which aren't required from the new metric to save space
mutate {
remove_field => ["[metric][dimensions][log_level]",
"[metric][dimensions][domain_id]",
"[metric][dimensions][user_id]",
"[metric][dimensions][tenant_id]",
"[metric][dimensions][project_domain]",
"[metric][dimensions][tag]",
"[metric][dimensions][Logger]",
"[metric][dimensions][Pid]",
"[metric][dimensions][user_domain]",
"[metric][dimensions][request_id]",
"[metric][dimensions][python_module]",
"[metric][meta]",
"creation_time",
"log",
"@version",
"@timestamp"]
}
}
output {
kafka {
codec => json
bootstrap_servers => "{{ monasca_kafka_servers }}"
topic_id => "{{ monasca_metrics_topic }}"
}
}