This is a prometheus exporter in a similar vein as mtail, but implemented to be able to read on TCP sockets, and with a YAML format. It is also capable of reading from log files or pipes.
It links against the libpcre library for faster regex'ing.
The configuration file is based on YAML. Prometheus metrics are required to have a consistent set of labels, but metrics may be repeated in the config file to allow multiple regexes to populate different timeseries.
Counting mail processing stages from exim:
metric_configs:
- name: exim_mail_count
help: counter of mail processing results
type: counter
regex: '^METRICS: uuid=(\S+) result=(\S+)'
labels:
- name: uuid
value: $1
- name: result
value: $2
value: increment
timeout: 15m
The lockfree hashmap used is non-deterministic on inserts being available before the next line is processed. We need to add an intermediate queue operation to wait of the hashmap to reflect an insert being complete.