gpt4 book ai didi

database - 如何在 postgresql 日志中获取已连接客户端的 mac 地址?

转载 作者:搜寻专家 更新时间:2023-10-30 20:34:41 26 4
gpt4 key购买 nike

每当用户连接到 PostgreSQL 数据库时,我想在 PostgreSQL 的日志文件中显示该连接用户的 MAC 地址。怎么做?

最佳答案

https://www.postgresql.org/docs/current/static/runtime-config-logging.html#guc-log-line-prefix

%a    Application name    yes
%u User name yes
%d Database name yes
%r Remote host name or IP address, and remote port yes
%h Remote host name or IP address yes
%p Process ID no
%t Time stamp without milliseconds no
%m Time stamp with milliseconds no
%n Time stamp with milliseconds (as a Unix epoch) no
%i Command tag: type of session's current command yes
%e SQLSTATE error code no
%c Session ID: see below no
%l Number of the log line for each session or process, starting at 1 no
%s Process start time stamp no
%v Virtual transaction ID (backendID/localXID) no
%x Transaction ID (0 if none is assigned) no
%q Produces no output, but tells non-session processes to stop at this point in the string; ignored by session processes no
%% Literal %

你不能。

当然你可以从 arp 缓存或其他系统实用程序中获取它,但不能使用 postgres log_line_prefix

关于database - 如何在 postgresql 日志中获取已连接客户端的 mac 地址?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46972820/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com