Audit Log File v11
The audit log file can be generated in either CSV or XML format depending upon the setting of the edb_audit
configuration parameter. The XML format contains less information than the CSV format.
The information in the audit log is based on the logging performed by PostgreSQL as described in the section “Using CSV-Format Log Output” within Section “Error Reporting and Logging” in the PostgreSQL core documentation, available at:
https://www.postgresql.org/docs/11/static/runtime-config-logging.html
The following table lists the fields in the order they appear in the CSV audit log format. The table contains the following information:
- Field. Name of the field as shown in the sample table definition in the PostgreSQL documentation as previously referenced.
- XML Element/Attribute. For the XML format, name of the XML element and its attribute (if used), referencing the value. Note:
n/a
indicates that there is no XML representation for this field. - Data Type. Data type of the field as given by the PostgreSQL sample table definition.
- Description. Description of the field. For certain fields, no output is generated in the audit log as those fields are not supported by auditing. Those fields are indicated by “Not supported”.
The fields with the Description
of “Not supported” appear as consecutive commas (,,) in the CSV format.
Field | XML Element/Attribute | Data Type | Description |
---|---|---|---|
log_time | event/time | timestamp with time zone | Log date/time of the statement. |
user_name | event/user | text | Database user who executed the statement. |
database_name | event/database | text | Database in which the statement was executed. |
process_id | event/process_id | integer | Operating system process ID in which the statement was executed. |
connection_from | event/remote_host | text | Host and port location from where the statement was executed. |
session_id | event/session_id | text | Session ID in which the statement was executed. |
session_line_num | n/a | bigint | Order of the statement within the session. |
process_status | n/a | text | Processing status. |
session_start_time | n/a | timestamp with time zone | Date/time when the session was started. |
virtual_transaction_id | n/a | text | Virtual transaction ID of the statement. |
transaction_id | event/transaction_id | bigint | Regular transaction ID of the statement. |
error_severity | message | text | Statement severity. Values are AUDIT for audited statements and ERROR for any resulting error messages. |
sql_state_code | n/a | text | SQL state code returned for the statement. |
message | message | text | The SQL statement that was attempted for execution. |
detail | n/a | text | Error message detail. (Not supported) |
hint | n/a | text | Hint (Not supported) |
internal_query | n/a | text | Internal query that led to the error, if any. (Not supported) |
internal_query_pos | n/a | integer | Character count of the error position therein. (Not supported) |
context | n/a | text | Error context. (Not supported) |
query | n/a | text | User query that led to the error. (For errors only) |
query_pos | n/a | integer | Character count of the error position therein. (For errors only) |
location | n/a | text | Location of the error in the PostgreSQL source code. (Not supported) |
application_name | n/a | text | Name of the application from which the statement was executed. (for example, psql.bin ). |
command_tag | event/command_tag | text | SQL command of the statement. |
audit_tag | event/audit_tag | text | Value specified by the audit_tag parameter in the configuration file. |
The following examples are generated in the CSV and XML formats.
The non-default audit settings in the postgresql.conf
file are as follows:
The edb_audit parameter
is changed to xml
when generating the XML format.
The audited session is the following:
CSV Audit Log File
The following is the CSV format of the audit log file.
Each audit log entry has been split and displayed across multiple lines, and a blank line has been inserted between the audit log entries for more clarity in the appearance of the results.
XML Audit Log File
The following is the XML format of the audit log file. The output has been formatted for more clarity in the appearance in the example.