Skip to main content

Description

The log_mon probe tails a log file, counting newly-appended lines matching includePattern (and not matching excludePattern). It tracks a byte offset between runs — only counts new lines, resets on truncation/rotation.

Config fields

FieldTypeRequiredDefaultDescription
typestringYesMust be "log_mon"
filePathstringYesLog file path to scan
includePatternstringYesRegex for lines to count
excludePatternstringNoRegex to exclude lines that matched include
maxAgeSecondsint64NoSkip scan if file hasn’t changed within this many seconds
readFromEndboolNotruetrue: start from EOF on first run. false: start from beginning

Metrics

MetricTypeDescription
vms.log_mon.match_countgaugeNumber of matching lines in this run

Example config

{
  "type": "log_mon",
  "filePath": "/var/log/app/app.log",
  "includePattern": "ERROR|FATAL",
  "excludePattern": "healthcheck",
  "maxAgeSeconds": 300
}

Notes

  • Reads up to 8 MiB per run. Remainder is picked up on the next tick.
  • Only counts complete lines (ending with \n).
  • File truncation (size drops below offset) resets to offset 0.