Skip to content

Instantly share code, notes, and snippets.

@ycyr
Created January 26, 2021 23:05
Show Gist options
  • Save ycyr/551374a8e77cfa6464f2ac4c847d0eff to your computer and use it in GitHub Desktop.
Save ycyr/551374a8e77cfa6464f2ac4c847d0eff to your computer and use it in GitHub Desktop.
fluentd-prometeus.conf
<source>
@type prometheus
@id in_prometheus
bind "#{ENV['FLUENTD_PROMETHEUS_BIND'] || '0.0.0.0'}"
port "#{ENV['FLUENTD_PROMETHEUS_PORT'] || '24231'}"
metrics_path "#{ENV['FLUENTD_PROMETHEUS_PATH'] || '/metrics'}"
</source>
<source>
@type prometheus_output_monitor
@id in_prometheus_output_monitor
</source>
<source>
@type kafka_group
brokers BROKERS:PORT
topics topics
consumer_group test
format json
</source>
<source>
@type forward
port 24224
bind 0.0.0.0
</source>
<match elkbeat>
@type rewrite_tag_filter
<rule>
key message
pattern /PATH/
tag path
</rule>
<rule>
key message
pattern /SYSCALL/
tag syscall
</rule>
<rule>
key message
pattern /.*/
tag other
</rule>
</match>
<filter syscall>
@type prometheus
<metric>
name SYSCALL
type counter
desc The total number of SYSCALL
<labels>
tag ${tag}
</labels>
</metric>
</filter>
<match syscall>
@type null
</match>
<filter path>
@type prometheus
<metric>
name PATH
type counter
desc The total number of PATH
<labels>
tag ${tag}
</labels>
</metric>
</filter>
<match path>
@type null
</match>
<filter other>
@type prometheus
<metric>
name OTHER
type counter
desc The total number of OTHER
<labels>
tag ${tag}
</labels>
</metric>
</filter>
<match other>
@type null
</match>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment