Prometheus Filter 🔗︎

Overview 🔗︎

Prometheus Filter Plugin to count Incoming Records

Configuration 🔗︎

PrometheusConfig 🔗︎

Variable Name Type Required Default Description
metrics []MetricSection No - Metrics Section
labels Label No -

Metrics Section 🔗︎

Variable Name Type Required Default Description
name string Yes - Metrics name
type string Yes - Metrics type counter, gauge, summary, histogram
desc string Yes - Description of metric
key string No - Key name of record for instrumentation.
buckets string No - Buckets of record for instrumentation
labels Label No - Additional labels for this metric

Example Prometheus filter configurations 🔗︎

apiVersion: logging.banzaicloud.io/v1beta1
kind: Flow
metadata:
 name: demo-flow
spec:
 filters:
   - tag_normaliser: {}
   - parser:
       remove_key_name_field: true
       reserve_data: true
       parse:
         type: nginx
   - prometheus:
       metrics:
       - name: total_counter
         desc: The total number of foo in message.
         type: counter
         labels:
           foo: bar
       labels:
         host: ${hostname}
         tag: ${tag}
         namespace: $.kubernetes.namespace
 selectors: {}
 localOutputRefs:
   - demo-output

Fluentd Config Result 🔗︎

 <filter **>
   @type prometheus
   @id logging-demo-flow_2_prometheus
   <metric>
     desc The total number of foo in message.
     name total_counter
     type counter
     <labels>
       foo bar
     </labels>
   </metric>
   <labels>
     host ${hostname}
     namespace $.kubernetes.namespace
     tag ${tag}
   </labels>
 </filter>