gp_toolkit.gp_log_database

posted Jan 20, 2014, 1:53 PM by Sachchida Ojha
gpadmin=# \d gp_toolkit.gp_log_database
View "gp_toolkit.gp_log_database"
Column | Type | Modifiers 
----------------+--------------------------+-----------
logtime | timestamp with time zone | 
loguser | text | 
logdatabase | text | 
logpid | text | 
logthread | text | 
loghost | text | 
logport | text | 
logsessiontime | timestamp with time zone | 
logtransaction | integer | 
logsession | text | 
logcmdcount | text | 
logsegment | text | 
logslice | text | 
logdistxact | text | 
loglocalxact | text | 
logsubxact | text | 
logseverity | text | 
logstate | text | 
logmessage | text | 
logdetail | text | 
loghint | text | 
logquery | text | 
logquerypos | integer | 
logcontext | text | 
logdebug | text | 
logcursorpos | integer | 
logfunction | text | 
logfile | text | 
logline | integer | 
logstack | text | 
View definition:
SELECT gp_log_system.logtime, gp_log_system.loguser, gp_log_system.logdatabase, gp_log_system.logpid, gp_log_system.logthread, gp_log_system.loghost, gp_log
_system.logport, gp_log_system.logsessiontime, gp_log_system.logtransaction, gp_log_system.logsession, gp_log_system.logcmdcount, gp_log_system.logsegment, g
p_log_system.logslice, gp_log_system.logdistxact, gp_log_system.loglocalxact, gp_log_system.logsubxact, gp_log_system.logseverity, gp_log_system.logstate, gp
_log_system.logmessage, gp_log_system.logdetail, gp_log_system.loghint, gp_log_system.logquery, gp_log_system.logquerypos, gp_log_system.logcontext, gp_log_s
ystem.logdebug, gp_log_system.logcursorpos, gp_log_system.logfunction, gp_log_system.logfile, gp_log_system.logline, gp_log_system.logstack
FROM gp_toolkit.gp_log_system
WHERE gp_log_system.logdatabase = current_database()::text

logtime=>The timestamp of the log message.
loguser=>The name of the database user.
logdatabase=>The name of the database.
logpid=>The associated process id (prefixed with "p").
logthread=>The associated thread count (prefixed with "th").
loghost=>The segment or master host name.
logport=>The segment or master port.
logsessiontime=>Time session connection was opened.
logtransaction=>Global transaction id.
logsession=>The session identifier (prefixed with "con").
logcmdcount=>The command number within a session (prefixed with "cmd").
logsegment=>The segment content identifier (prefixed with "seg" for primary or "mir" for mirror. The master always has a content id of -1).
logslice=>The slice id (portion of the query plan being executed).
logdistxact=>Distributed transaction id.
loglocalxact=>Local transaction id.
logsubxact=>Subtransaction id.
logseverity=>LOG, ERROR, FATAL, PANIC, DEBUG1 or DEBUG2.
logstate=>SQL state code associated with the log message.
logmessage=>Log or error message text.
logdetail=>Detail message text associated with an error message.
loghint=>Hint message text associated with an error message.
logquery=>The internally-generated query text.
logquerypos=>The cursor index into the internally-generated query text.
logcontext=>The context in which this message gets generated.
logdebug=>Query string with full detail for debugging.
logcursorpos=>The cursor index into the query string.
logfunction=>The function in which this message is generated.
logfile=>The log file in which this message is generated.
logline=>The line in the log file in which this message is generated.
logstack=>Full text of the stack trace associated with this message.

This view uses an external table to read the server log files of the entire Greenplum system (master, segments, and mirrors) and lists log entries associated with the current database. Associated log entries can be identified by the session id (logsession) and command id (logcmdcount). 
The use of this view requires superuser permissions.

gpadmin=# select * from gp_toolkit.gp_log_database limit 10;
logtime | loguser | logdatabase | logpid | logthread | loghost | logport | logsessiontime | logtransaction | logsessi
on | logcmdcount | logsegment | logslice | logdistxact | loglocalxact | logsubxact | logseverity | logstate | 
logmessage | logdetail | loghint | logquery | logquerypos | logcontext | 
logdebug | logcursorpos | logfunction | logfile | logline | logstack 
-------------------------------+---------+-------------+--------+---------------+--------------+---------+------------------------+----------------+---------
---+-------------+------------+----------+-------------+--------------+------------+-------------+----------+------------------------------------------------
----------------------------------------------------------------------------+-----------+---------+----------+-------------+------------+--------------------
---------------------------------------------------------------------------------------------+--------------+-------------+------------+---------+----------
2013-11-27 12:55:25.721427-05 | gpadmin | gpadmin | p19653 | th1344132864 | [local] | | 2013-11-27 12:55:25-05 | 0 | con11 
| | seg-1 | | | | | FATAL | 3D000 | database "gpadmin" does not exist 
| | | | | | 
| 0 | | postinit.c | 404 | 
2013-11-27 14:20:29.534951-05 | gpadmin | gpadmin | p26167 | th1318504192 | [local] | | 2013-11-27 14:20:19-05 | 1111 | con8 
| cmd1 | seg-1 | | dx3 | x1111 | sx1 | LOG | 00000 | statement: alter role sachi login; 
| | | | | | alter role sachi lo
gin; | 0 | | postgres.c | 1542 | 
2013-11-27 14:20:29.542075-05 | gpadmin | gpadmin | p26171 | th-1635629312 | 192.168.1.13 | 59892 | 2013-11-27 14:20:29-05 | 975 | con8 
| | seg0 | | | x975 | sx1 | LOG | 00000 | binding to 192.168.1.13 only 
| | | | | | 
| 0 | | ic_tcp.c | 230 | 
2013-11-27 14:20:29.549326-05 | gpadmin | gpadmin | p26173 | th-460380416 | 192.168.1.13 | 43424 | 2013-11-27 14:20:29-05 | 975 | con8 
| | seg1 | | | x975 | sx1 | LOG | 00000 | binding to 192.168.1.13 only 
| | | | | | 
| 0 | | ic_tcp.c | 230 | 
2013-11-27 14:21:12.910452-05 | gpadmin | gpadmin | p26167 | th1318504192 | [local] | | 2013-11-27 14:20:19-05 | 1113 | con8 
| cmd2 | seg-1 | | dx4 | x1113 | sx1 | LOG | 00000 | statement: CREATE RESOURCE QUEUE perf_test ACTI
VE THRESHOLD 2 COST THRESHOLD 100000000 IGNORE THRESHOLD 100000 OVERCOMMIT; | | | | | | CREATE RESOURCE QUE
UE perf_test ACTIVE THRESHOLD 2 COST THRESHOLD 100000000 IGNORE THRESHOLD 100000 OVERCOMMIT; | 0 | | postgres.c | 1542 | 
2013-11-27 14:21:12.914221-05 | gpadmin | gpadmin | p26208 | th-1635629312 | 192.168.1.13 | 59897 | 2013-11-27 14:21:12-05 | 978 | con8 
| | seg0 | | | x978 | sx1 | LOG | 00000 | binding to 192.168.1.13 only 
| | | | | | 
| 0 | | ic_tcp.c | 230 | 
2013-11-27 14:21:12.91816-05 | gpadmin | gpadmin | p26210 | th-460380416 | 192.168.1.13 | 43429 | 2013-11-27 14:21:12-05 | 978 | con8 
| | seg1 | | | x978 | sx1 | LOG | 00000 | binding to 192.168.1.13 only 
| | | | | | 
| 0 | | ic_tcp.c | 230 | 
2013-11-28 08:41:19.141128-05 | gpadmin | gpadmin | p29778 | th1318504192 | [local] | | 2013-11-28 08:41:06-05 | 1115 | con10 
| cmd1 | seg-1 | | dx5 | x1115 | sx1 | LOG | 00000 | statement: SELECT n.nspname AS "Name", 
| | | | | | SELECT n.nspname AS
"Name", | 0 | | postgres.c | 1542 | 

: pg_catalog.pg_get_userbyid(n.nspowner) AS "Ow
ner" : pg_catalog.pg_get
_userbyid(n.nspowner) AS "Owner" 

: FROM pg_catalog.pg_namespace n 
: FROM pg_catalog.pg_
namespace n 

: WHERE (n.nspname !~ '^pg_temp_' OR 
: WHERE (n.nspname 
!~ '^pg_temp_' OR 

: n.nspname = (pg_catalog.curren
t_schemas(true))[1]) : n.
nspname = (pg_catalog.current_schemas(true))[1]) 

: ORDER BY 1; 
: ORDER BY 1; 

2013-11-29 08:42:14.328884-05 | gpadmin | gpadmin | p10441 | th1318504192 | [local] | | 2013-11-29 08:42:06-05 | 1188 | con14 
| cmd1 | seg-1 | | dx74 | x1188 | sx1 | LOG | 00000 | statement: select version(); 
| | | | | | select version(); 
| 0 | | postgres.c | 1542 | 
2014-01-18 02:16:42.3651-05 | gpadmin | gpadmin | p30158 | th39933696 | [local] | | 2014-01-18 02:16:25-05 | 1379 | con7 
| cmd1 | seg-1 | | dx3 | x1379 | sx1 | LOG | 00000 | statement: SELECT c.oid, 
| | | | | | SELECT c.oid, 
| 0 | | postgres.c | 1542 | 

: n.nspname, 
: n.nspname, 


: c.relname 
: c.relname 


: FROM pg_catalog.pg_class c 
: FROM pg_catalog.pg_
class c 

: LEFT JOIN pg_catalog.pg_namespace n ON n.o
id = c.relnamespace : LEFT JOIN pg_c
atalog.pg_namespace n ON n.oid = c.relnamespace 

: WHERE n.nspname ~ '^(pg_catalog)#39; 
: WHERE n.nspname ~ '
^(pg_catalog)#39; 

: ORDER BY 2, 3; 
: ORDER BY 2, 3; 

(10 rows)

gpadmin=# 
Comments