RefLib

Reference library for AI

Back

postgresql_16:4.5.8.5 Using JSON-Format Log Output

PostgreSQL 16 > Server Administration > Server Configuration > Error Reporting and Logging > Using JSON-Format Log Output

Including jsonlog in the log_destination list provides a convenient way to import log files into many different programs. This option emits log lines in JSON format.

String fields with null values are excluded from output. Additional fields may be added in the future. User applications that process jsonlog output should ignore unknown fields.

Each log line is serialized as a JSON object with the set of keys and their associated values shown in (see runtime-config-logging-jsonlog-keys-values).

| Key name | Type | Description | | --- | --- | --- | | timestamp | string | Time stamp with milliseconds | | user | string | User name | | dbname | string | Database name | | pid | number | Process ID | | remote_host | string | Client host | | remote_port | number | Client port | | session_id | string | Session ID | | line_num | number | Per-session line number | | ps | string | Current ps display | | session_start | string | Session start time | | vxid | string | Virtual transaction ID | | txid | string | Regular transaction ID | | error_severity | string | Error severity | | state_code | string | SQLSTATE code | | message | string | Error message | | detail | string | Error message detail | | hint | string | Error message hint | | internal_query | string | Internal query that led to the error | | internal_position | number | Cursor index into internal query | | context | string | Error context | | statement | string | Client-supplied query string | | cursor_position | number | Cursor index into query string | | func_name | string | Error location function name | | file_name | string | File name of error location | | file_line_num | number | File line number of the error location | | application_name | string | Client application name | | backend_type | string | Type of backend | | leader_pid | number | Process ID of leader for active parallel workers | | query_id | number | Query ID |

Back