Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2016
    Posts
    1

    Answered: log_connections - showing the remote user

    Hi

    We would like to audit login attemts to the PG databasen, and have set the parameter

    log_connections = on

    It logs fine, showing the remote hostname where the login attempt originated.

    But we would like to see the remote linux user name (who performed the login attempt. Ex. using "psql").

    Is it possible ?

    Best regards
    Martin

  2. Best Answer
    Posted by shammat

    "
    But we would like to see the remote linux user name
    That's not possible. The Postgres server does not (and can not) know the remote operating system user (and what about other operating systems?)

    (who performed the login attempt. Ex. using "psql")
    psql is typically the name of the command line client, not a username.

    The name of the application initiating the connection however can be logged. But be aware that this is an information that the client provides (and can be changed any time even after the connection has been established). I can easily connect to the server using the application name "DbForums With Firefox".

    For a full list of variables/placeholders that can be used when configuring logging, please see the manual:

    https://www.postgresql.org/docs/curr...OG-LINE-PREFIX"


  3. #2
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    But we would like to see the remote linux user name
    That's not possible. The Postgres server does not (and can not) know the remote operating system user (and what about other operating systems?)

    (who performed the login attempt. Ex. using "psql")
    psql is typically the name of the command line client, not a username.

    The name of the application initiating the connection however can be logged. But be aware that this is an information that the client provides (and can be changed any time even after the connection has been established). I can easily connect to the server using the application name "DbForums With Firefox".

    For a full list of variables/placeholders that can be used when configuring logging, please see the manual:

    https://www.postgresql.org/docs/curr...OG-LINE-PREFIX
    I will not read nor answer questions where the SQL code is messy and not formatted properly using [code] tags: http://www.dbforums.com/misc.php?do=bbcode#code

    Tips for good questions:

    http://tkyte.blogspot.de/2005/06/how...questions.html
    http://wiki.postgresql.org/wiki/SlowQueryQuestions
    http://catb.org/esr/faqs/smart-questions.html

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •