Skip to content

if string exists #174

@davidy718

Description

@davidy718

How can I have it so I search if a string exists in a log file
tired something like this

global:
  config_version: 3
input:
  type: file
  path: /var/logs/logfile.log
  readall: true
metrics:
- type: gauge
  name: error_in_log
  help: Error has been found in log.
  match: 'error'
  value: '{{if "error"}}1{{else}}0{{end}}'
  labels:
    logfile: '{{base .logfile}}'
server:
  port: 9144

if the string error is found in log file error_in_log will have the value of 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions