grok_exporter icon indicating copy to clipboard operation
grok_exporter copied to clipboard

documentation: "path" vs "paths" for file input

Open vmpjdc opened this issue 5 years ago • 3 comments
trafficstars

The documentation says "path is used if you want to monitor a single path. If you want to monitor a list of paths, use paths instead" but does not explain why.

I've inherited a grok_exporter setup that uses multiple "file" inputs, apparently successfully, and I'm interested to know why this is discouraged.

vmpjdc avatar Apr 03 '20 00:04 vmpjdc

Hello, is it possible have 3 paths of logs and match some metrics with log1 and some other metrics to log 2. paths: - log0 - log1

metric - type: counter name: HTTP_Request help: number of log lines match: '*' file.path: log0

- type: counter
  name: HTTP_Request
  help: number of log lines 
  match: *
  file.path: log 1

matze1508 avatar Apr 07 '20 11:04 matze1508

@jetpackdanger the difference between path and paths is that with path you can only specify a single value like this:

path: /tmp/example/example.log

while with paths you can specify a list of values like this

paths:
  - /tmp/example/example1.log
  - /tmp/example/example2.log

I think the YAML parser does not support the same key path for both a list and a single value, so I used path for the single value and paths for the list.

I'm not sure what you mean by multiple "file" inputs. Could you paste an example?

fstab avatar Apr 14 '20 20:04 fstab

@matze1508 yes, this should be possible like this:

- type: counter
  name: HTTP_Request
  help: number of log lines
  match: .*
  path: log1

Note that match is .* and not *, because it's a regular expression and not a Glob.

fstab avatar Apr 14 '20 20:04 fstab