postgresql-日志表

pg_log,数据库日志表postgresqllog
CREATE TABLE postgres_log
(
log_time timestamp(3) with time zone, 日志生成时间
user_name text, 登陆用户名
database_name text, 数据库名
process_id integer,
connection_from text,登陆ip
session_id text,
session_line_num bigint,
command_tag text,
session_start_time timestamp with time zone,
virtual_transaction_id text,
transaction_id bigint,
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,应用名称
PRIMARY KEY (session_id, session_line_num)
);
 
csv日志中对应列的解释:
A:日志生成时间
B:登陆用户名
C:数据库名
E:登陆ip
L:日志级别
M:日志错误代码
N:异常信息
O:异常详细信息
T:查询脚本
W:应用名称
 
 
COPY postgres_log FROM 'd:\datafile\postgresql-2018-04-17_094948.csv' WITH csv;
 
 
将数据库日志拷贝到表中
 
 
 
原文地址:https://www.cnblogs.com/zhangfx01/p/10216297.html