README.md 1.62 KB
Newer Older
Jérome Perrin's avatar
Jérome Perrin committed
1 2
# grafana / telegraf / influxdb

3 4
This is an experimental integration, mainly to evaluate these solutions.

Jérome Perrin's avatar
Jérome Perrin committed
5 6 7 8 9 10
## Custom telegraf plugins


See https://github.com/influxdata/telegraf to learn about plugins.

Useful plugins in this context are probably
11 12
[exec](https://github.com/influxdata/telegraf/tree/1.11.1/plugins/inputs/exec),
[logparser](https://github.com/influxdata/telegraf/tree/1.11.1/plugins/inputs/logparser)
Jérome Perrin's avatar
Jérome Perrin committed
13
or
14
[http](https://github.com/influxdata/telegraf/tree/1.11.1/plugins/inputs/http).
Jérome Perrin's avatar
Jérome Perrin committed
15 16 17 18 19 20

Telegraf will save in the `telegraf` database from the embedded influxdb server.


## Grafana

21 22
A default user is created, username and password are published as connection
parameters. You can add more users in grafana interface.
Jérome Perrin's avatar
Jérome Perrin committed
23

24
Datasources should be automatically added.
Jérome Perrin's avatar
Jérome Perrin committed
25

26 27 28 29 30 31 32 33
## Influxdb

Influxdb backups are not done automatically by this software release.

One important thing to notice is that the backup protocol is enabled on ipv4
provided by slapos, so make sure this ip is not reachable from untrusted
sources.

34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
# Ingesting/Visualizing logs

Eventhough main feature is visualizing metrics, Grafana has a feature called "Explore" to view logs for a time frame.
The following backend can be used:

## Loki

See `TestLoki` in test for an example.

## Influxdb

Influxdb logs only have tags and there does not seem to be a way to search (except than tag and time frame).

To inject log files containing:
```
INFO the message
WARN another message
```

use config like:

```
[[inputs.logparser]]
  files = ["/tmp/x*.log", "/tmp/aaa.log"]
Jérome Perrin's avatar
Jérome Perrin committed
58

59 60 61 62
  [inputs.logparser.grok]
  measurement = "logs"
  patterns = ['^%{WORD:level:tag} %{GREEDYDATA:message:string}']
```