gplogfilter
The utility can be used to search through a Greenplum Database log file for entries matching the specified criteria. If an input file is not supplied, then gplogfilter
will use the $MASTER_DATA_DIRECTORY
environment variable to locate the Greenplum master log file in the standard logging location. To read from standard input, use a dash (-
) as the input file name. Input files may be compressed using gzip
. In an input file, a log entry is identified by its timestamp in YYYY-MM-DD [hh:mm[:ss]]
format.
You can also use gplogfilter
to search through all segment log files at once by running it through the gpssh utility. For example, to display the last three lines of each segment log file:
gpssh -f seg_host_file
=> source /usr/local/greenplum-db/greenplum_path.sh
By default, the output of gplogfilter
is sent to standard output. Use the -o
option to send the output to a file or a directory. If you supply an output file name ending in .gz
, the output file will be compressed by default using maximum compression. If the output destination is a directory, the output file is given the same name as the input file.
Timestamp Options
-b datetime | —begin=datetime
Specifies a starting date and time to begin searching for log entries in the format of .
If a time is specified, the date and time must be enclosed in either single or double quotes. This example encloses the date and time in single quotes:
-e datetime | —end=datetime
Specifies an ending date and time to stop searching for log entries in the format of YYYY-MM-DD [hh:mm[:ss]]
.
If a time is specified, the date and time must be enclosed in either single or double quotes. This example encloses the date and time in single quotes:
gplogfilter -e '2013-05-23 14:33'
-d time | —duration=time
Specifies a time duration to search for log entries in the format of [hh][:mm[:ss]]
. If used without either the -b
or -e
option, will use the current time as a basis.
Pattern Matching Options
-c i [gnore] | r [espect] | —case=i [gnore] | r [espect]
Matching of alphabetic characters is case sensitive by default unless proceeded by the --case=ignore
option.
-C ‘string’ | —columns=’string’
-f ‘string’ | —find=’string’
Finds the log entries containing the specified string.
-F ‘string’ | —nofind=’string’
Rejects the log entries containing the specified string.
-m regex | —match=regex
Finds log entries that match the specified Python regular expression. See https://docs.python.org/library/re.html for Python regular expression syntax.
-M regex | —nomatch=regex
Rejects log entries that match the specified Python regular expression. See for Python regular expression syntax.
-t | —trouble
Finds only the log entries that have ERROR:
, FATAL:
, or PANIC:
in the first line.
Output Options
-n integer | —tail=integer
Limits the output to the last integer of qualifying log entries found.
-s offset [limit] | —slice=offset [limit]
From the list of qualifying log entries, returns the limit number of entries starting at the offset entry number, where an offset of zero ( 0
) denotes the first entry in the result set and an offset of any number greater than zero counts back from the end of the result set.
-o output_file | —out=output_file
-z 0-9 | —zip=0-9
Compresses the output file to the specified compression level using gzip
, where is no compression and 9
is maximum compression. If you supply an output file name ending in .gz
, the output file will be compressed by default using maximum compression.
-a | —append
If the output file already exists, appends to the file instead of overwriting it.
Input Options
input_file
The name of the input log file(s) to search through. If an input file is not supplied, gplogfilter
will use the $MASTER_DATA_DIRECTORY
environment variable to locate the Greenplum Database master log file. To read from standard input, use a dash ( -
) as the input file name.
-u | —unzip
Uncompress the input file using gunzip
. If the input file name ends in .gz
, it will be uncompressed by default.
--help
Displays the online help.
--version
Displays the version of this utility.
Display the last three error messages in the master log file:
Display all log messages in the master log file timestamped in the last 10 minutes:
gplogfilter -d :10
Display log messages in the master log file containing the string |con6 cmd11|
:
gpssh -f seg_hosts_file -e 'source
con6 /gpdata/*/pg_log/gpdb*.csv' > seglog.out