Whenever user connects to PostgreSQL database, i want to show the MAC address of that connected user in the log file of PostgreSQL. How to do it?
Asked
Active
Viewed 847 times
1 Answers
1
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 %
you can't.
Of course you can get it form arp cache or other system utility, but not with postgres log_line_prefix

Vao Tsun
- 47,234
- 13
- 100
- 132