agens-graph - 如何在 AgensGraph 上记录 ddl 命令?
问题描述
我是 AgensGraph 的管理员,想记录所有 ddl。另外,我想知道那个运行 ddl 的用户。
有什么好的想法吗?
解决方案
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]
推荐阅读
- time-series - 高效地将大型时间序列数据集加载到 Graphite 中
- parsing - Pyparsing 对 Wikipedia 自定义预处理需要太长时间
- authentication - cakephp 1.3 - 我如何允许同时使用电话号码和用户名登录?
- amazon-web-services - 通过 Boto3 访问 S3 中的特定文件,无需更高级别的存储桶权限
- javascript - djs 获取收集按钮
- python - 是否可以找到给定类变量的类名
- next.js - 处理Next Js中的动态路由,避免与其他动态路由发生冲突
- c# - 如何获取另一个 XML 命名空间值?
- java - 尝试在 Spring Boot 中获取 Hikari Pool 活动连接时出现 InstanceNotFoundException
- php - PHP:重构 count() 以避免警告“参数必须是实现 Countable 的数组或对象”