Skip to content

Snatch is a l2met parser that inserts the data into InfluxDB

License

Notifications You must be signed in to change notification settings

nrwiersma/snatch

Repository files navigation

Logo

Go Report Card Build Status Coverage Status GitHub release GitHub license

About

Snatch is a l2met parser that inserts the data into InfluxDB. If it cannot parse the line, it outputs back to stdout.

Installation

Download the binary or

$ go get github.com/nrwiersma/snatch/cmd/snatch

Usage

Snatch 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#[email protected]=2 foo="bar" size=10

Snatch requires the --db flag with the DSN of InfluxDB in the format

$ snatch --db=http://localhost:8086/database

optionally you can set the resolution of the buckets (default is 10s)

$ snatch --db=http://localhost:8086/database --res=30s

Setting these options can be tedious, so a YAML config file can be used (default path is ~/.snatch.yaml)

$ snatch --config=testdata/config.yaml

which is in the form

db: http://localhost:8086/metrics
res: 30s