Snatch is a l2met parser that inserts the data into InfluxDB. If it cannot parse the line, it outputs back to stdout.
Download the binary or
$ go get github.com/nrwiersma/snatch/cmd/snatchSnatch parse metrics in logfmt lines from stdin in the format
lvl=info msg= count#test=2 foo="bar" size=10
The time is optional, defaulting to now, and the lvl and msg will be ignored in the metrics.
All other non-metric pieces will be used as tags in the metric.
While not standard, snatch handles sampling. You can add the sample rate at the end of the
name separated by an @
lvl=info msg= count#test@0.1=2 foo="bar" size=10
Snatch requires the --db flag with the DSN of InfluxDB in the format
$ snatch --db=http://localhost:8086/databaseoptionally you can set the resolution of the buckets (default is 10s)
$ snatch --db=http://localhost:8086/database --res=30sSetting these options can be tedious, so a YAML config file can be used (default path is ~/.snatch.yaml)
$ snatch --config=testdata/config.yamlwhich is in the form
db: http://localhost:8086/metrics
res: 30s