Hi,
I desperately try to extract metrics from a tabulated file to send them to loki but I can’t achieve to get a working config.
I use a regex to extract each “columns” (this one works as I can get values into loki using labels)
But I definitely can’t get them as metrics and I can’t figure out why (promtail logs don’t tell anything).
Here is a sample line :
2020-10-28 18:30:22.260 +0100 1 91 1 9 100 15 4 29 0 0 0 8 0 818 0 0 0
and my config
- job_name: Stats
pipeline_stages:
- regex:
expression: "^(?P<timestamp>[^\t]+)\t(?P<NetIn>[^\t]+)\t(?P<NetOut>[^\t]+)\t(?P<DiskRead>[^\t]+)\t(?P<DiskWrite>[^\t]+)\t(?P<Cache>[^\t]+)\t(?P<RAW>[^\t]+)\t(?P<Sessions>[^\t]+)\t(?P<OpS>[^\t]+)\t(?P<Actions>[^\t]+)\t(?P<Views>[^\t]+)\t(?P<Pass>[^\t]+)\t(?P<Bom>[^\t]+)\t(?P<CI>[^\t]+)\t(?P<ElapsedTime>[^\t]+)\t(?P<WaitTime>[^\t]+)\t(?P<IOTime>[^\t]+)\t(?P<top>[^\t]+)$"
- metrics:
NetIn:
type: Histogram
source: NetIn
prefix: custom_
config:
action: inc
NetOut:
type: Histogram
prefix: custom_
source: NetOut
config:
action: inc
static_configs:
- targets:
- localhost
labels:
job: stats
__path__: /var/log/sample/my_log.log
The log file have headers, could that impact the parsing ?
Any help/advise is welcome