云数据库 GAUSSDB-使用CSV格式写日志:csvlog定义
csvlog定义
以“逗号分隔值” 即CSV(Comma Separated Value)的形式发出日志。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
CREATE TABLE postgres_log
(
log_time timestamp(3) with time zone,
node_name text,
user_name text,
database_name text,
process_id bigint,
connection_from text,
"session_id" text,
session_line_num bigint,
command_tag text,
session_start_time timestamp with time zone,
virtual_transaction_id text,
transaction_id bigint,
query_id bigint,
module text,
error_severity text,
sql_state_code text,
message text,
detail text,
hint text,
internal_query text,
internal_query_pos integer,
context text,
query text,
query_pos integer,
location text,
application_name text
);
|
详细说明请参见表1。
字段名 |
字段含义 |
字段名 |
字段含义 |
---|---|---|---|
log_time |
毫秒级的时间戳 |
module |
日志所属模块 |
node_name |
节点名称 |
error_severity |
ERRORSTATE代码 |
user_name |
用户名 |
sql_state_code |
SQLSTATE代码 |
database_name |
数据库名 |
message |
错误消息 |
process_id |
进程ID |
detail |
详细错误消息 |
connection_from |
客户主机:端口号 |
hint |
提示 |
session_id |
会话ID |
internal_query |
内部查询(查询那些导致错误的信息,如果有的话) |
session_line_num |
每个会话的行数 |
internal_query_pos |
内部查询指针 |
command_tag |
命令标签 |
context |
环境 |
session_start_time |
会话开始时间 |
query |
错误发生位置的字符统计 |
virtual_transaction_id |
常规事务 |
query_pos |
错误发生位置指针 |
transaction_id |
事务ID |
location |
在GaussDB源代码中错误的位置(如果log_error_verbosity的值设为verbose ) |
query_id |
查询ID |
application_name |
应用名称 |
1 |
COPY postgres_log FROM '/opt/data/pg_log/logfile.csv' WITH csv;
|
此处的日志名“logfile.csv”要换成实际生成的日志的名称。