Add openstack_panko label
Change-Id: Ie19e894c6f6d839eb6f4a79b13c3a7d589eb1890
Closes-Bug: PROD-24758
diff --git a/panko/meta/fluentd.yml b/panko/meta/fluentd.yml
index 13823a1..bd93aac 100644
--- a/panko/meta/fluentd.yml
+++ b/panko/meta/fluentd.yml
@@ -67,4 +67,102 @@
tag: 'metric.**'
type: relabel
label: default_metric
+ openstack_panko:
+ filter:
+ set_panko_programname:
+ tag: openstack.panko.*
+ type: record_transformer
+ enable_ruby: true
+ record:
+ - name: programname
+ value: panko
+ set_panko_fields:
+ tag: openstack.panko
+ type: record_transformer
+ enable_ruby: true
+ record:
+ - name: Severity
+ value: ${ {'TRACE'=>7,'DEBUG'=>7,'INFO'=>6,'AUDIT'=>6,'WARNING'=>4,'ERROR'=>3,'CRITICAL'=>2}[record['level']].to_i }
+ - name: severity_label
+ value: ${ record['level'] }
+ - name: Payload
+ value: ${ record['message'] }
+ - name: python_module
+ value: ${ record['name'] }
+ parse_http_stats:
+ tag: openstack.panko
+ type: parser
+ key_name: Payload
+ reserve_data: true
+ emit_invalid_record_to_error: false
+ parser:
+ type: regexp
+ # Parse openstack http stats: https://regex101.com/r/Tf0XUK/1/
+ format: '\"(?<http_method>GET|POST|OPTIONS|DELETE|PUT|HEAD|TRACE|CONNECT|PATCH)\s(?<http_url>\S+)\s(?<http_version>[.\/\dHTFSP]+)\"\sstatus:\s(?<http_status>\d{3})\slen:\s(?<http_response_size>\d+)\stime:\s(?<http_response_time>\d+\.\d+)'
+ types: http_response_time:float
+ match:
+ unify_tag:
+ tag: openstack.panko.*
+ type: rewrite_tag_filter
+ rule:
+ - name: level
+ regexp: '.*'
+ result: openstack.panko
+ send_to_default:
+ tag: openstack.panko
+ type: copy
+ store:
+ - type: relabel
+ label: default_output
+ - type: rewrite_tag_filter
+ rule:
+ - name: severity_label
+ regexp: '.'
+ result: metric.panko_log_messages
+ - type: rewrite_tag_filter
+ rule:
+ - name: http_status
+ regexp: '.'
+ result: metric.panko_openstack_http_response
+ push_to_metric:
+ tag: 'metric.**'
+ type: relabel
+ label: default_metric
+ default_metric:
+ filter:
+ panko_logs_per_severity:
+ tag: metric.panko_log_messages
+ require:
+ - add_general_fields
+ type: prometheus
+ metric:
+ - name: log_messages
+ type: counter
+ desc: Total number of log lines by severity
+ label:
+ - name: service
+ value: panko
+ - name: level
+ value: ${severity_label}
+ - name: host
+ value: ${Hostname}
+ panko_openstack_http_response_times:
+ tag: metric.panko_openstack_http_response
+ require:
+ - add_general_fields
+ type: prometheus
+ metric:
+ - name: openstack_http_response_times
+ type: summary
+ desc: Total number of requests per method and status
+ key: http_response_time
+ label:
+ - name: http_method
+ value: ${http_method}
+ - name: http_status
+ value: ${http_status}
+ - name: service
+ value: panko
+ - name: host
+ value: ${Hostname}
{% endif %}