Skip to main content

Usage examples

Capture all new lines from .log files

pandora_logparser --dir /var/log/myapp --name-regex '.+\.log'

Filter only lines containing ERROR

pandora_logparser --dir /var/log/myapp --name-regex '.+\.log' --content-regex '(?i)error' --source-type myapp_errors

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

pandora_logparser --dir /opt/app/logs --name-regex 'access.*\.log' --content-regex '^50[023]' --source-type http_errors --idx-dir /var/spool/pandora

Typical Execution Flow

# First execution: creates indexes, no output
pandora_logparser --dir /tmp/logs --name-regex '.+\.log' --content-regex 'ERROR' --source-type 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
pandora_logparser --dir /tmp/logs --name-regex '.+\.log' --content-regex 'ERROR' --source-type 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
pandora_logparser --dir /tmp/logs --name-regex '.+\.log' --content-regex 'ERROR' --source-type my_source