如何在AgensGraph上记录ddl命令?

时间:2019-01-21 08:08:26

标签: agens-graph

我是AgensGraph的管理员,并希望记录所有ddl。 另外,我想知道那个运行ddl的用户。

关于它有好主意吗?

1 个答案:

答案 0 :(得分:0)

AgensGraph上有语句日志。

首先,更改“ postgresql.conf”上的参数

log_connections = on
log_disconnections = on
log_line_prefix = '[%c] '
log_statement = 'ddl'

第二,重新启动AgensGraph。

$ ag_ctl stop
waiting for server to shut down.... done
server stopped
$ ag_ctl start
server starting

最后,运行ddl并检查日志文件。

$ agens 
agens (AgensGraph 1.3.1, based on PostgreSQL 9.6.2)
Type "help" for help.

agens =# create vlabel n;
CREATE VLABEL
agens=# \quit

结合连接日志,您可以获得运行ddl的信息。

[5c4573ae.f84] LOG:  connection received: host=[local]
[5c4573ae.f84] LOG:  connection authorized: user=agens database=agens
[5c4573ae.f84] LOG:  statement: create vlabel n;
[5c4573ae.f84] LOG:  disconnection: session time: 0:00:07.783 user=agens database=agens host=[local]