Log entries are not showing in GPCC dashboard
search cancel

Log entries are not showing in GPCC dashboard

book

Article ID: 296502

calendar_today

Updated On:

Products

VMware Tanzu Greenplum

Issue/Introduction

GPCC dashboard has a feature that prints log messages from the master log. If this is blank and not showing anything, then there could be some issue with the log collector. 

The log collector uses this external table definition in gpperfmon database under gpmetrics schema to check for the log file name and size:
CREATE EXTERNAL WEB TABLE gpmetrics._gpcc_pg_log_last_file (
	  last_log_file TEXT
	, last_offset   BIGINT
)
EXECUTE E'find $GP_SEG_DATADIR/pg_log/ -maxdepth 1 -name "gpdb*.csv" | sort -r | head -n 20 | xargs ls -l | gawk \'{print $9 "," $5}\''
ON MASTER
FORMAT 'csv' (delimiter E',' null E'' escape E'"' quote E'"')
ENCODING 'UTF8';

A successful run will look like this:
gpperfmon=# select * from gpmetrics._gpcc_pg_log_last_file;
                     last_log_file                      | last_offset
--------------------------------------------------------+-------------
 /data/master/gpseg-1/pg_log/gpdb-2020-09-01_000000.csv |  4469954146
 /data/master/gpseg-1/pg_log/gpdb-2020-09-02_000000.csv |  7580147594
(2 rows)

If your username or group OS name contains a space, this will cause the external table to fail:
-rw------- 1 gpadmin Domain Users  4469954146 Sep  2 00:00 gpdb-2020-09-01_000000.csv
-rw------- 1 gpadmin Domain Users  7558475241 Sep  3 16:58 gpdb-2020-09-02_000000.csv
[gpadmin6@mdw logs]$ find /data/master/gpseg-1/pg_log/ -maxdepth 1 -name "gpdb*.csv" | sort -r | head -n 20 | xargs ls -l | gawk '{print $9 "," $5}'
00:00,Users
16:57,Users

This causes an error when querying the table:
gpperfmon=# select * from gpmetrics._gpcc_pg_log_last_file;
ERROR:  invalid input syntax for integer: "Users"
CONTEXT:  External table _gpcc_pg_log_last_file, line 1 of execute:find $GP_SEG_DATADIR/pg_log/ -maxdepth 1 -name "gpdb*.csv" | sort -r | head -n 20 | xargs ls -l | gawk '{print $9 "," $5}', column last_offset


Environment

Product Version: 5.24

Resolution

The workaround is to drop the external table in gpperfmon database:
DROP EXTERNAL WEB TABLE gpmetrics._gpcc_pg_log_last_file;

Modify the external table definition to use the correct fields. In this case, add an offset of 1:
CREATE EXTERNAL WEB TABLE gpmetrics._gpcc_pg_log_last_file (
	  last_log_file TEXT
	, last_offset   BIGINT
)
EXECUTE E'find $GP_SEG_DATADIR/pg_log/ -maxdepth 1 -name "gpdb*.csv" | sort -r | head -n 20 | xargs ls -l | gawk \'{print $10 "," $6}\''
ON MASTER
FORMAT 'csv' (delimiter E',' null E'' escape E'"' quote E'"')
ENCODING 'UTF8';
After a minute, the log should show up in the GPCC dashboard.