Skip to main content

Usage examples

Capture all new lines from .log files

advlogparser /var/log/myapp '.*\.log'

Filter only lines containing ERROR

advlogparser /var/log/myapp '.*\.log' '(?i)error' 'myapp_errors'

Filter by file name and content, with a custom index directory

advlogparser --idx-dir /var/spool/pandora /opt/app/logs 'access.*\.log' '^50[023]' 'http_errors'

Typical Execution Flow

# First execution: creates indexes, no output
advlogparser /tmp/logs '.*\.log' 'ERROR' 'my_source'

# New lines are written to the log
printf 'INFO: ok\nERROR: disk full\n' >> /tmp/logs/app.log

# Second execution: only captures new lines containing ERROR
advlogparser /tmp/logs '.*\.log' 'ERROR' 'my_source'

Generated output:

<log_module>
  <source><![CDATA[my_source]]></source>
  <data encoding="base64">RVJST1I6IGRpc2NvIGxsZW5v</data>
</log_module>
# Third execution with no changes: no output
advlogparser /tmp/logs '.*\.log' 'ERROR' 'my_source'