'\" t .\" Title: pdbtool .\" Author: [see the "Author" section] .\" Generator: DocBook XSL Stylesheets v1.79.1 .\" Date: 12/25/2018 .\" Manual: The pdbtool manual page .\" Source: 3.19 .\" Language: English .\" .TH "PDBTOOL" "1" "12/25/2018" "3\&.19" "The pdbtool manual page" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" pdbtool \- An application to test and convert syslog\-ng pattern database rules .SH "SYNOPSIS" .HP \w'\fBpdbtool\fR\ 'u \fBpdbtool\fR [command] [options] .SH "DESCRIPTION" .PP This manual page is only an abstract, for the complete documentation of syslog\-ng and pdbtool, see \m[blue]\fB\fBThe syslog\-ng Administrator Guide\fR\fR\m[]\&\s-2\u[1]\d\s+2\&. .PP 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\&. .PP The \fBpdbtool\fR application is a utility that can be used to: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} test messages, or specific rules .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} convert an older pattern database to the latest database format .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} merge pattern databases into a single file .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} automatically create pattern databases from a large amount of log messages .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} dump the RADIX tree built from the pattern database (or a part of it) to explore how the pattern matching works\&. .RE .SH "THE DICTIONARY COMMAND" .HP \w'\fBdictionary\fR\ 'u \fBdictionary\fR [options] .PP Lists every name\-value pair that can be set by the rules of the pattern database\&. .PP \fB\-\-dump\-tags\fR or \fB\-T\fR .RS 4 List the tags instead of the names of the name\-value pairs\&. .RE .PP \fB\-\-pdb \fR or \fB\-p \fR .RS 4 Name of the pattern database file to use\&. .RE .PP \fB\-\-program \fR or \fB\-P \fR .RS 4 List only the name\-value pairs that can be set for the messages of the specified \fI$PROGRAM\fR application\&. .RE .SH "THE DUMP COMMAND" .HP \w'\fBdump\fR\ 'u \fBdump\fR [options] .PP 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\&. .PP \fB\-\-debug\fR or \fB\-d\fR .RS 4 Enable debug/diagnostic messages on stderr\&. .RE .PP \fB\-\-pdb\fR or \fB\-p\fR .RS 4 Name of the pattern database file to use\&. .RE .PP \fB\-\-program\fR or \fB\-P\fR .RS 4 Displays the RADIX tree built from the patterns belonging to the \fI${PROGRAM}\fR application\&. .RE .PP \fB\-\-program\-tree\fR or \fB\-T\fR .RS 4 Display the \fI${PROGRAM}\fR tree\&. .RE .PP \fB\-\-verbose\fR or \fB\-v\fR .RS 4 Enable verbose messages on stderr\&. .RE .PP Example and sample output: .sp .if n \{\ .RS 4 .\} .nf pdbtool dump \-p patterndb\&.xml \-P \*(Aqsshd\*(Aq .fi .if n \{\ .RE .\} .sp .if n \{\ .RS 4 .\} .nf \*(Aqp\*(Aq \*(Aqassword for\*(Aq @QSTRING:@ \*(Aqfrom\*(Aq @QSTRING:@ \*(Aqport \*(Aq @NUMBER:@ rule_id=\*(Aqfc49054e\-75fd\-11dd\-9bba\-001e6806451b\*(Aq \*(Aq ssh\*(Aq rule_id=\*(Aqfc55cf86\-75fd\-11dd\-9bba\-001e6806451b\*(Aq \*(Aq2\*(Aq rule_id=\*(Aqfc4b7982\-75fd\-11dd\-9bba\-001e6806451b\*(Aq \*(Aqublickey for\*(Aq @QSTRING:@ \*(Aqfrom\*(Aq @QSTRING:@ \*(Aqport \*(Aq @NUMBER:@ rule_id=\*(Aqfc4d377c\-75fd\-11dd\-9bba\-001e6806451b\*(Aq \*(Aq ssh\*(Aq rule_id=\*(Aqfc5441ac\-75fd\-11dd\-9bba\-001e6806451b\*(Aq \*(Aq2\*(Aq rule_id=\*(Aqfc44a9fe\-75fd\-11dd\-9bba\-001e6806451b\*(Aq .fi .if n \{\ .RE .\} .SH "THE MATCH COMMAND" .HP \w'\fBmatch\fR\ 'u \fBmatch\fR [options] .PP Use the \fBmatch\fR 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 \fI0\fR (success) or \fI1\fR (no match) return code and displays the following information: .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} the class assigned to the message (that is, system, violation, and so on), .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} the ID of the rule that matched the message, and .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} the values of the parsers (if there were parsers in the matching pattern)\&. .RE .PP The \fBmatch\fR command has the following options: .PP \fB\-\-color\-out \fR or \fB\-c\fR .RS 4 Color the terminal output to highlight the part of the message that was successfully parsed\&. .RE .PP \fB\-\-debug\fR or \fB\-d\fR .RS 4 Enable debug/diagnostic messages on stderr\&. .RE .PP \fB\-\-debug\-csv\fR or \fB\-C\fR .RS 4 Print the debugging information returned by the \fI\-\-debug\-pattern\fR option as comma\-separated values\&. .RE .PP \fB\-\-debug\-pattern\fR or \fB\-D\fR .RS 4 Print debugging information about the pattern matching\&. See also the \fI\-\-debug\-csv\fR option\&. .RE .PP \fB\-\-file=\fR or \fB\-f\fR .RS 4 Process the messages of the specified log file with the pattern database\&. This option allows to classify messages offline, and to apply the pattern database to already existing logfiles\&. To read the messages from the standard input (stdin), specify a hyphen (\fI\-\fR) character instead of a filename\&. .RE .PP \fB\-\-filter=\fR or \fB\-F\fR .RS 4 Print only messages matching the specified syslog\-ng filter expression\&. .RE .PP \fB\-\-message\fR or \fB\-M\fR .RS 4 The text of the log message to match (only the \fI${MESSAGE}\fR part without the syslog headers)\&. .RE .PP \fB\-\-pdb\fR or \fB\-p\fR .RS 4 Name of the pattern database file to use\&. .RE .PP \fB\-\-program\fR or \fB\-P\fR .RS 4 Name of the program to use, as contained in the \fI${PROGRAM}\fR part of the syslog message\&. .RE .PP \fB\-\-template=\fR or \fB\-T\fR .RS 4 A syslog\-ng template expression that is used to format the output messages\&. .RE .PP \fB\-\-verbose\fR or \fB\-v\fR .RS 4 Enable verbose messages on stderr\&. .RE .PP Example: The following command checks if the patterndb\&.xml file recognizes the \fIAccepted publickey for myuser from 127\&.0\&.0\&.1 port 59357 ssh2\fR message: .sp .if n \{\ .RS 4 .\} .nf pdbtool match \-p patterndb\&.xml \-P sshd \-M "Accepted publickey for myuser from 127\&.0\&.0\&.1 port 59357 ssh2" .fi .if n \{\ .RE .\} .PP 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 \fIuseracct\fR tag\&. .sp .if n \{\ .RS 4 .\} .nf pdbtool match \-p sshd\&.pdb \e \(enfile /var/log/messages \e \(enfilter \(oqtags(\(lqusracct\(rq);\(cq .fi .if n \{\ .RE .\} .SH "THE MERGE COMMAND" .HP \w'\fBmerge\fR\ 'u \fBmerge\fR [options] .PP Use the \fBmerge\fR 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 \m[blue]\fB\fBThe syslog\-ng Administrator Guide\fR\fR\m[]\&\s-2\u[1]\d\s+2 for details on the different pattern database versions\&. .PP \fB\-\-debug\fR or \fB\-d\fR .RS 4 Enable debug/diagnostic messages on stderr\&. .RE .PP \fB\-\-directory\fR or \fB\-D\fR .RS 4 The directory that contains the pattern database XML files to be merged\&. .RE .PP \fB\-\-glob\fR or \fB\-G\fR .RS 4 Specify filenames to be merged using a glob pattern, for example, using wildcards\&. For details on glob patterns, see \fBman glob\fR\&. This pattern is applied only to the filenames, and not on directory names\&. .RE .PP \fB\-\-pdb\fR or \fB\-p\fR .RS 4 Name of the output pattern database file\&. .RE .PP \fB\-\-recursive\fR or \fB\-r\fR .RS 4 Merge files from subdirectories as well\&. .RE .PP \fB\-\-verbose\fR or \fB\-v\fR .RS 4 Enable verbose messages on stderr\&. .RE .PP Example: .sp .if n \{\ .RS 4 .\} .nf pdbtool merge \-\-recursive \-\-directory /home/me/mypatterns/ \-\-pdb /var/lib/syslog\-ng/patterndb\&.xml .fi .if n \{\ .RE .\} .sp 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\&. .SH "THE PATTERNIZE COMMAND" .HP \w'\fBpatternize\fR\ 'u \fBpatternize\fR [options] .PP 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 \fBpdbtool patternize\fR command uses a data clustering technique to find similar log messages and replacing the differing parts with \fI@ESTRING:: @\fR parsers\&. For details on pattern databases and message parsers, see the \m[blue]\fB\fBThe syslog\-ng Administrator Guide\fR\fR\m[]\&\s-2\u[1]\d\s+2\&. The \fBpatternize\fR command is available only in version 3\&.2 and later\&. .PP \fB\-\-debug\fR or \fB\-d\fR .RS 4 Enable debug/diagnostic messages on stderr\&. .RE .PP \fB\-\-file=\fR or \fB\-f\fR .RS 4 The logfile containing the log messages to create patterns from\&. To receive the log messages from the standard input (stdin), use \fI\-\fR\&. .RE .PP \fB\-\-iterate\-outliers\fR or \fB\-o\fR .RS 4 Recursively iterate on the log lines to cover as many log messages with patterns as possible\&. .RE .PP \fB\-\-named\-parsers\fR or \fB\-n\fR .RS 4 The number of example log messages to include in the pattern database for every pattern\&. Default value: \fI1\fR .RE .PP \fB\-\-no\-parse\fR or \fB\-p\fR .RS 4 Do not parse the input file, treat every line as the message part of a log message\&. .RE .PP \fB\-\-samples=\fR .RS 4 Include a generated name in the parsers, for example, \fI\&.dict\&.string1\fR, \fI\&.dict\&.string2\fR, and so on\&. .RE .PP \fB\-\-support=\fR or \fB\-S\fR .RS 4 A pattern is added to the output pattern database if at least the specified percentage of log messages from the input logfile match the pattern\&. For example, if the input logfile contains 1000 log messages and the \fI\-\-support=3\&.0\fR option is used, a pattern is created only if the pattern matches at least 3 percent of the log messages (that is, 30 log messages)\&. If patternize does not create enough patterns, try to decrease the support value\&. .sp Default value: \fI4\&.0\fR .RE .PP \fB\-\-verbose\fR or \fB\-v\fR .RS 4 Enable verbose messages on stderr\&. .RE .PP Example: .sp .if n \{\ .RS 4 .\} .nf pdbtool patternize \-\-support=2\&.5 \-\-file=/var/log/messages .fi .if n \{\ .RE .\} .SH "THE TEST COMMAND" .HP \w'\fBtest\fR\ 'u \fBtest\fR [options] .PP Use the \fBtest\fR command to validate a pattern database XML file\&. Note that you must have the \fBxmllint\fR application installed\&. The \fBtest\fR command is available only in version 3\&.2 and later\&. .PP \fB\-\-color\-out\fR or \fB\-c\fR .RS 4 Enable coloring in terminal output\&. .RE .PP \fB\-\-debug\fR or \fB\-d\fR .RS 4 Enable debug/diagnostic messages on stderr\&. .RE .PP \fB\-\-debug\fR or \fB\-D\fR .RS 4 Print debugging information on non\-matching patterns\&. .RE .PP \fB\-\-rule\-id\fR or \fB\-r\fR .RS 4 Test only the patterndb rule (specified by its rule id) against its example\&. .RE .PP \fB\-\-validate\fR .RS 4 Validate a pattern database XML file\&. .RE .PP \fB\-\-verbose\fR or \fB\-v\fR .RS 4 Enable verbose messages on stderr\&. .RE .PP Example: .sp .if n \{\ .RS 4 .\} .nf pdbtool test \-\-validate /home/me/mypatterndb\&.pdb .fi .if n \{\ .RE .\} .SH "FILES" .PP /usr/ .PP /etc/syslog\-ng/syslog\-ng\&.conf .SH "SEE ALSO" .PP \m[blue]\fB\fBThe syslog\-ng Administrator Guide\fR\fR\m[]\&\s-2\u[1]\d\s+2 .PP \fBsyslog\-ng\&.conf\fR(5) .PP \fBsyslog\-ng\fR(8) .if n \{\ .sp .\} .RS 4 .it 1 an-trap .nr an-no-space-flag 1 .nr an-break-flag 1 .br .ps +1 \fBNote\fR .ps -1 .br .PP For the detailed documentation of see \m[blue]\fB\fBThe 3\&.19 Administrator Guide\fR\fR\m[]\&\s-2\u[2]\d\s+2 .PP If you experience any problems or need help with syslog\-ng, visit the \m[blue]\fB\fBsyslog\-ng mailing list\fR\fR\m[]\&\s-2\u[3]\d\s+2\&. .PP For news and notifications about of syslog\-ng, visit the \m[blue]\fB\fBsyslog\-ng blogs\fR\fR\m[]\&\s-2\u[4]\d\s+2\&. .sp .5v .RE .SH "AUTHOR" .PP This manual page was written by the Balabit Documentation Team \&. .SH "COPYRIGHT" .SH "NOTES" .IP " 1." 4 \fBThe syslog-ng Administrator Guide\fR .RS 4 \%https://www.balabit.com/support/documentation/ .RE .IP " 2." 4 \fBThe 3.19 Administrator Guide\fR .RS 4 \%https://www.balabit.com/documents/syslog-ng-ose-latest-guides/en/syslog-ng-ose-guide-admin/html/index.html .RE .IP " 3." 4 \fBsyslog-ng mailing list\fR .RS 4 \%https://lists.balabit.hu/mailman/listinfo/syslog-ng .RE .IP " 4." 4 \fBsyslog-ng blogs\fR .RS 4 \%https://syslog-ng.org/blogs/ .RE