https://github.com/nrwiersma/snatch
Snatch is a l2met parser that inserts the data into InfluxDB
https://github.com/nrwiersma/snatch
influxdb l2met parser
Last synced: about 1 year ago
JSON representation
Snatch is a l2met parser that inserts the data into InfluxDB
- Host: GitHub
- URL: https://github.com/nrwiersma/snatch
- Owner: nrwiersma
- License: mit
- Created: 2018-10-26T05:56:56.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-12-04T04:59:18.000Z (over 7 years ago)
- Last Synced: 2025-01-30T18:32:19.081Z (over 1 year ago)
- Topics: influxdb, l2met, parser
- Language: Go
- Homepage:
- Size: 43.9 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README

[](https://goreportcard.com/report/github.com/nrwiersma/snatch)
[](https://travis-ci.org/nrwiersma/snatch)
[](https://coveralls.io/github/nrwiersma/snatch?branch=master)
[](https://github.com/nrwiersma/snatch/releases)
[](https://raw.githubusercontent.com/nrwiersma/snatch/master/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](https://github.com/nrwiersma/snatch/releases) or
```bash
$ 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#test@0.1=2 foo="bar" size=10
```
Snatch requires the `--db` flag with the DSN of InfluxDB in the format
```bash
$ snatch --db=http://localhost:8086/database
```
optionally you can set the resolution of the buckets (default is `10s`)
```bash
$ 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`)
```bash
$ snatch --config=testdata/config.yaml
```
which is in the form
```yaml
db: http://localhost:8086/metrics
res: 30s
```