logspark

command module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 13, 2023 License: AGPL-3.0 Imports: 8 Imported by: 0

README

logspark

Run shell commands based on regex pattern matches in one or more continuously read files.

Running logspark

  logspark <path to configuration file>

Configuration

logspark is configured using a TOML file as follows:

logging = "minimal"
# logging can be set to "none", "minimal", or "verbose"
# - none: disables logging
# - minimal: <timestamp> | <file path> | <RegEx pattern name> | <matched line>
# - verbose: <timestamp> | <file path> | <RegEx pattern name> | <RegEx pattern> | <command that ran> | <alert message> | <matched line>

log_file = "none"
# log_file can be set to "none", "stdout", or any valid path
# - none: no log file
# - stdout: print to stdout (console)
# - /path/to/log/file: the path to the desired log file (is created if it doesn't exist)

files = [ "/path/to/file", "/var/log/dmesg" ] # must be an array
# These are the tailed files

[[regex]]
name = "Name of RegEx pattern"
regex = '''RegEx pattern''' #must be a literal string (no TOML escaping)
command = '''command to run when the pattern is matched'''
alert = '''same as above, but used for alerting'''

[[regex]]
name = "reboot"
regex = '''reboot'''
command = '''sleep 60; reboot'''
alert = '''wall 'Rebooting in 60 seconds!''''

You can watch as many files and search for as many regex patterns as you like.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL