# https://docs.fluentbit.io/manual/pipeline/filters/log_to_metrics # INDENTATION WITH SPACES NOT TABS [SERVICE] parsers_file parsers.conf log_file /var/log/fluent-bit.log [INPUT] name cpu tag hw.cpu interval_sec 5 [INPUT] name mem tag hw.mem interval_sec 5 [INPUT] name disk tag hw.disk interval_sec 5 [INPUT] name netif tag hw.netif interval_sec 5 interface eth0 # CPU [FILTER] name log_to_metrics match hw.cpu tag hw_metrics metric_mode gauge metric_name cpu_p value_field cpu_p metric_description CPU usage % # RAM [FILTER] name log_to_metrics match hw.mem tag hw_metrics metric_mode gauge metric_name mem.used value_field Mem.used metric_description used RAM bytes [FILTER] name log_to_metrics match hw.mem tag hw_metrics metric_mode gauge metric_name mem.total value_field Mem.total metric_description total RAM bytes # DISK I/O [FILTER] name log_to_metrics match hw.disk tag hw_metrics metric_mode gauge metric_name write_size value_field write_size metric_description disk output [FILTER] name log_to_metrics match hw.disk tag hw_metrics metric_mode gauge metric_name read_size value_field read_size metric_description disk input # TX/RX [FILTER] name log_to_metrics match hw.netif tag hw_metrics metric_mode gauge metric_name eth0.tx.bytes value_field eth0.tx.bytes metric_description TX bytes [FILTER] name log_to_metrics match hw.netif tag hw_metrics metric_mode gauge metric_name eth0.rx.bytes value_field eth0.rx.bytes metric_description RX bytes [FILTER] name log_to_metrics match hw.netif tag hw_metrics metric_mode gauge metric_name eth0.tx.packets value_field eth0.tx.packets metric_description TX pkts [FILTER] name log_to_metrics match hw.netif tag hw_metrics metric_mode gauge metric_name eth0.rx.packets value_field eth0.rx.packets metric_description RX pkts [FILTER] name modify match hw.* add sensor flb@HOSTNAME-HERE [OUTPUT] name file match hw_metrics path /var/log file fluent-bit.vmetrics.log [OUTPUT] name prometheus_remote_write match hw_metrics host SERVER-ADDRESS-HERE port 443 tls on tls.verify on http_user BASIC-AUTH-USER-HERE http_passwd BASIC-AUTH-PASSWORD-HERE # standalone uri /api/v1/write # cluster #uri /insert/0/prometheus/api/v1/write log_response_payload true add_label sensor flb@HOSTNAME-HERE