PDBTOOL(1) | The pdbtool manual page | PDBTOOL(1) |
pdbtool - An application to test and convert syslog-ng pattern database rules
pdbtool [command] [options]
This manual page is only an abstract, for the complete documentation of syslog-ng and pdbtool, see The syslog-ng Administrator Guide[1].
The syslog-ng application can match the contents of the log messages to a database of predefined message patterns (also called patterndb). By comparing the messages to the known patterns, syslog-ng is able to identify the exact type of the messages, tag the messages, and sort them into message classes. The message classes can be used to classify the type of the event described in the log message. The functionality of the pattern database is similar to that of the logcheck project, but the syslog-ng approach is faster, scales better, and is much easier to maintain compared to the regular expressions of logcheck.
The pdbtool application is a utility that can be used to:
dictionary [options]
Lists every name-value pair that can be set by the rules of the pattern database.
--dump-tags or -T
--pdb <path-to-file> or -p <path-to-file>
--program <programname> or -P <programname>
dump [options]
Display the RADIX tree built from the patterns. This shows how are the patterns represented in syslog-ng and it might also help to track down pattern-matching problems. The dump utility can dump the tree used for matching the PROGRAM or the MESSAGE parts.
--debug or -d
--pdb or -p
--program or -P
--program-tree or -T
--verbose or -v
Example and sample output:
pdbtool dump -p patterndb.xml -P 'sshd'
'p'
'assword for'
@QSTRING:@
'from'
@QSTRING:@
'port '
@NUMBER:@ rule_id='fc49054e-75fd-11dd-9bba-001e6806451b'
' ssh' rule_id='fc55cf86-75fd-11dd-9bba-001e6806451b'
'2' rule_id='fc4b7982-75fd-11dd-9bba-001e6806451b'
'ublickey for'
@QSTRING:@
'from'
@QSTRING:@
'port '
@NUMBER:@ rule_id='fc4d377c-75fd-11dd-9bba-001e6806451b'
' ssh' rule_id='fc5441ac-75fd-11dd-9bba-001e6806451b'
'2' rule_id='fc44a9fe-75fd-11dd-9bba-001e6806451b'
match [options]
Use the match command to test the rules in a pattern database. The command tries to match the specified message against the patterns of the database, evaluates the parsers of the pattern, and also displays which part of the message was parsed successfully. The command returns with a 0 (success) or 1 (no match) return code and displays the following information:
The match command has the following options:
--color-out or -c
--debug or -d
--debug-csv or -C
--debug-pattern or -D
--file=<filename-with-path> or -f
--filter=<filter-expression> or -F
--message or -M
--pdb or -p
--program or -P
--template=<template-expression> or -T
--verbose or -v
Example: The following command checks if the patterndb.xml file recognizes the Accepted publickey for myuser from 127.0.0.1 port 59357 ssh2 message:
pdbtool match -p patterndb.xml -P sshd -M "Accepted publickey for myuser from 127.0.0.1 port 59357 ssh2"
The following example applies the sshd.pdb pattern database file to the log messages stored in the /var/log/messages file, and displays only the messages that received a useracct tag.
pdbtool match -p sshd.pdb \
–file /var/log/messages \
–filter ‘tags(“usracct”);’
merge [options]
Use the merge command to combine separate pattern database files into a single file (pattern databases are usually stored in separate files per applications to simplify maintenance). If a file uses an older database format, it is automatically updated to the latest format (V3). See the The syslog-ng Administrator Guide[1] for details on the different pattern database versions.
--debug or -d
--directory or -D
--glob or -G
--pdb or -p
--recursive or -r
--verbose or -v
Example:
pdbtool merge --recursive --directory /home/me/mypatterns/ --pdb /var/lib/syslog-ng/patterndb.xml
Currently it is not possible to convert a file without merging, so if you only want to convert an older pattern database file to the latest format, you have to copy it into an empty directory.
patternize [options]
Automatically create a pattern database from a log file containing a large number of log messages. The resulting pattern database is printed to the standard output (stdout). The pdbtool patternize command uses a data clustering technique to find similar log messages and replacing the differing parts with @ESTRING:: @ parsers. For details on pattern databases and message parsers, see the The syslog-ng Administrator Guide[1]. The patternize command is available only in version 3.2 and later.
--debug or -d
--file=<path> or -f
--iterate-outliers or -o
--named-parsers or -n
--no-parse or -p
--samples=<number-of-samples>
--support=<number> or -S
Default value: 4.0
--verbose or -v
Example:
pdbtool patternize --support=2.5 --file=/var/log/messages
test [options]
Use the test command to validate a pattern database XML file. Note that you must have the xmllint application installed. The test command is available only in version 3.2 and later.
--color-out or -c
--debug or -d
--debug or -D
--rule-id or -r
--validate
--verbose or -v
Example:
pdbtool test --validate /home/me/mypatterndb.pdb
/usr/
/etc/syslog-ng/syslog-ng.conf
The syslog-ng Administrator Guide[1]
For the detailed documentation of see The 3.28 Administrator Guide[2]
If you experience any problems or need help with syslog-ng, visit the syslog-ng mailing list[3].
For news and notifications about of syslog-ng, visit the syslog-ng blogs[4].
This manual page was written by the Balabit Documentation Team <documentation@balabit.com>.
02/28/2023 | 3.28 |