'\" t .\" Title: pdbtool .\" Author: [see the "Author" section] .\" Generator: DocBook XSL Stylesheets v1.76.1 .\" Date: 03/20/2013 .\" Manual: The pdbtool manual page .\" Source: syslog-ng Open Source Edition 3.3 .\" Language: English .\" .TH "PDBTOOL" "1" "03/20/2013" "syslog\-ng Open Source Edition" "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 message patterns; .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 .\} dump the RADIX tree built from the pattern database (or a part of it) to explore how the pattern matching works\&. .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 MSG parts\&. .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 Example and sample output: .sp .if n \{\ .RS 4 .\} .nf pdbtool dump \-p patterndb\&.xml \-P \*(Aqsshd\*(Aq .fi .if n \{\ .RE .\} .sp .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\-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 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\-\-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 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 syslog\-ng OSE version 3\&.2 and later\&. .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\-\-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 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 syslog\-ng OSE version 3\&.2 and later\&. .PP \fB\-\-validate\fR .RS 4 Validate a pattern database XML file\&. .RE .PP Example: .sp .if n \{\ .RS 4 .\} .nf pdbtool test \-\-validate /home/me/mypatterndb\&.pdb .fi .if n \{\ .RE .\} .SH "FILES" .PP /opt/syslog\-ng/bin/pdbtool .PP /opt/syslog\-ng/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) .PP \m[blue]\fB\fBThe syslog\-ng OSE 3\&.3 Administrator Guide\fR\fR\m[]\&\s-2\u[1]\d\s+2 .PP If you experience any problems or need help with syslog\-ng, visit \m[blue]\fBvisit the syslog\-ng wiki\fR\m[]\&\s-2\u[2]\d\s+2 or 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 Insider Blog\fR\fR\m[]\&\s-2\u[4]\d\s+2\&. .SH "AUTHOR" .PP This manual page was written by the BalaBit Documentation Team \&. .SH "COPYRIGHT" .SS "" .PP The authors grant permission to copy, distribute and/or modify this manual page under the terms of the GNU General Public License Version 2 or newer (GPL v2+)\&. .SH "NOTES" .IP " 1." 4 \fBThe syslog-ng Administrator Guide\fR .RS 4 \%http://www.balabit.com/support/documentation/ .RE .IP " 2." 4 visit the syslog-ng wiki .RS 4 \%http://www.balabit.com/wiki/syslog-ng-faq .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 Insider Blog\fR .RS 4 \%http://insider.blogs.balabit.com .RE