# PostgreSQL REL_17_2 src/backend/utils/error/elog.c send_message_to_server_log: log_line_prefix, then "%s:  " from error_severity() (DEBUG LOG INFO NOTICE WARNING ERROR FATAL PANIC); DETAIL, HINT, QUERY, CONTEXT, LOCATION and STATEMENT lines repeat the prefix and carry no severity of their own
# src/backend/utils/misc/postgresql.conf.sample: log_line_prefix = '%m [%p] ', where %m is "%Y-%m-%d %H:%M:%S.mmm %Z"; the beats tests also carry user@db, [pid-line] and key=value prefix fields
# Lines from Elastic beats v9.5.5 filebeat/module/postgresql/log/test and lnav v0.14.1 postgres_log samples
2017-04-07 22:45:30.218 CEST [22603] postgres@mydb ERROR:  operator does not exist: jsonb @> at character 49 ⇒ {"rule": "postgres", "level": "error", "name": "", "message": "operator does not exist: jsonb @> at character 49", "prefixed": true}
2017-05-27 14:08:13.661 UTC [1308] postgres@mydb FATAL:  database "mydb" does not exist ⇒ {"rule": "postgres", "level": "critical", "name": "", "message": "database \"mydb\" does not exist"}
2017-07-31 13:46:23 EST [768-1] postgres@postgres FATAL:  the database system is starting up ⇒ {"rule": "postgres", "level": "critical", "name": "", "message": "the database system is starting up"}
2019-07-23 12:06:33.732 UTC [44] ERROR:  42704: unrecognized configuration parameter "config_filel" ⇒ {"rule": "postgres", "level": "error", "name": "", "message": "42704: unrecognized configuration parameter \"config_filel\""}
2017-07-31 13:36:43 EST [835-1] LOG:  autovacuum launcher started ⇒ {"rule": "postgres", "level": "info", "leveled": true, "name": "", "message": "autovacuum launcher started"}
2017-04-03 22:32:14.322 CEST [12975-1] [unknown]@[unknown] LOG:  incomplete startup packet ⇒ {"rule": "postgres", "level": "info", "leveled": true, "name": "", "message": "incomplete startup packet"}
2019-09-22 06:28:24 UTC LOG:  duration: 112.337 ms  execute S_59: UPDATE qrtz_TRIGGERS SET TRIGGER_STATE = $1 WHERE SCHED_NAME = 'Scheduler_1' AND TRIGGER_NAME = $2 AND TRIGGER_GROUP = $3 AND TRIGGER_STATE = $4 ⇒ {"rule": "postgres", "level": "info", "leveled": true, "name": "", "message": "duration: 112.337 ms  execute S_59: UPDATE qrtz_TRIGGERS SET TRIGGER_STATE = $1 WHERE SCHED_NAME = 'Scheduler_1' AND TRIGGER_NAME = $2 AND TRIGGER_GROUP = $3 AND TRIGGER_STATE = $4"}
2025-08-13 01:45:01.127 PDT [12347] LOG:  database system was shut down at 2025-08-13 01:44:58 PDT ⇒ {"rule": "postgres", "level": "info", "leveled": true, "name": "", "message": "database system was shut down at 2025-08-13 01:44:58 PDT"}
2021-12-03 07:14:48.591 UTC [4913] user=user1,db=mydb LOG:  duration: 0.211 ms  statement: SELECT current_setting('nj.maint') ⇒ {"rule": "postgres", "level": "info", "leveled": true, "name": "", "message": "duration: 0.211 ms  statement: SELECT current_setting('nj.maint')"}
2022-02-17 06:45:10.440 -0800 [691] [queryid=1081270519976314062] postgres@stackoverflow LOG:  duration: 0.140 ms  statement: set log_min_duration_statement to 0; ⇒ {"rule": "postgres", "level": "info", "leveled": true, "name": "", "message": "duration: 0.140 ms  statement: set log_min_duration_statement to 0;"}
2017-09-06 08:40:10 UTC [20]: [1-1] user=,db=,app=,client= LOG:  database system was shut down at 2017-09-06 08:40:08 UTC ⇒ {"rule": "postgres", "level": "info", "leveled": true, "name": "", "message": "database system was shut down at 2017-09-06 08:40:08 UTC"}
# the parts of a report after its first line print no severity
2020-04-15 12:04:45.416 CEST [24981] DETAIL:  Role "root" does not exist. ⇒ {"rule": "postgres", "level": "info", "leveled": false, "name": "", "message": "Role \"root\" does not exist."}
2019-07-23 12:06:33.732 UTC [44] STATEMENT:  show config_filel; ⇒ {"rule": "postgres", "level": "info", "leveled": false, "name": "", "message": "show config_filel;"}
2019-07-23 12:06:24.406 UTC [25] LOCATION:  StartupXLOG, xlog.c:6388 ⇒ {"rule": "postgres", "level": "info", "leveled": false, "name": "", "message": "StartupXLOG, xlog.c:6388"}
2017-07-31 13:46:02 EST [832-2] HINT:  Consider increasing the configuration parameter "max_wal_size". ⇒ {"rule": "postgres", "level": "info", "leveled": false, "name": "", "message": "Consider increasing the configuration parameter \"max_wal_size\"."}
# constructed 2026-10-21 14:03:01.123 UTC [812] WARNING:  there is no transaction in progress ⇒ {"rule": "postgres", "level": "warn", "name": "", "message": "there is no transaction in progress"}
# constructed 2026-10-21 14:03:01.123 UTC [812] NOTICE:  table "pump" does not exist, skipping ⇒ {"rule": "postgres", "level": "info", "leveled": true, "name": "", "message": "table \"pump\" does not exist, skipping"}
# constructed 2026-10-21 14:03:01.123 UTC [812] PANIC:  could not write to file "pg_wal/xlogtemp.812": No space left on device ⇒ {"rule": "postgres", "level": "critical", "name": "", "message": "could not write to file \"pg_wal/xlogtemp.812\": No space left on device"}
# constructed 2026-10-21 14:03:01.123 UTC [812] DEBUG:  autovacuum: processing database "acme" ⇒ {"rule": "postgres", "level": "debug", "name": "", "message": "autovacuum: processing database \"acme\""}
# constructed 2026-10-21 14:03:01.123 UTC [812] INFO:  vacuuming "public.pump" ⇒ {"rule": "postgres", "level": "info", "leveled": true, "name": "", "message": "vacuuming \"public.pump\""}
# constructed 2026-10-21 14:03:01.123 UTC [812] CONTEXT:  SQL statement "SELECT 1" ⇒ {"rule": "postgres", "level": "info", "leveled": false, "name": "", "message": "SQL statement \"SELECT 1\""}
# before PostgreSQL 10 log_line_prefix was empty; a bare ERROR or WARNING is any program's level word
# constructed LOG:  database system is ready to accept connections ⇒ {"rule": "postgres", "level": "info", "leveled": true, "name": "", "message": "database system is ready to accept connections"}
# constructed STATEMENT:  SELECT * FROM pump; ⇒ {"rule": "postgres", "level": "info", "leveled": false, "name": "", "message": "SELECT * FROM pump;"}
# constructed HINT:  No function matches the given name and argument types. ⇒ {"rule": "postgres", "level": "info", "leveled": false, "name": "", "message": "No function matches the given name and argument types."}
# constructed ERROR:  relation "pump" does not exist at character 15 ⇒ {"rule": "level-word", "level": "error", "message": "relation \"pump\" does not exist at character 15"}
# constructed WARNING:  Invalid HTTP request received. ⇒ {"rule": "level-word", "level": "warn", "message": "Invalid HTTP request received."}
# the severity follows the prefix, never the message; elog.c prints two spaces after it
2025-06-05 17:10:04 MSK [608647-3] [local] postgres@postgres WARNING: terminating connection because of crash of another server process ⇒ {"rule": "plain", "level": "info", "leveled": false, "message": "2025-06-05 17:10:04 MSK [608647-3] [local] postgres@postgres WARNING: terminating connection because of crash of another server process"}
# constructed 2026-10-21 14:03:01.123 UTC app started; got ERROR:  in the sentence ⇒ {"rule": "plain", "level": "info", "leveled": false, "message": "2026-10-21 14:03:01.123 UTC app started; got ERROR:  in the sentence"}
# constructed 2026-10-21 14:03:01.123 UTC [812] LOG: one space ⇒ {"rule": "plain", "level": "info", "leveled": false, "message": "2026-10-21 14:03:01.123 UTC [812] LOG: one space"}
# constructed 2026-10-21 14:03:01.123 UTC [812] log:  lower case ⇒ {"rule": "plain", "level": "info", "leveled": false, "message": "2026-10-21 14:03:01.123 UTC [812] log:  lower case"}
# constructed 2026-10-21 14:03:01.123 UTC [812] FAILURE:  not a severity ⇒ {"rule": "plain", "level": "info", "leveled": false, "message": "2026-10-21 14:03:01.123 UTC [812] FAILURE:  not a severity"}
# constructed 2026-10-21 14:03:01,123 [812] ERROR:  a comma in the stamp is a configured layout ⇒ {"rule": "layout", "level": "error", "message": "a comma in the stamp is a configured layout"}
# constructed LOG: one space and no prefix ⇒ {"rule": "plain", "level": "info", "leveled": false, "message": "LOG: one space and no prefix"}
# constructed ERROR: one space is the level-word format ⇒ {"rule": "level-word", "level": "error", "message": "one space is the level-word format"}
2021-01-03 17:45:17.612 UTC,"jose.villanova","postgres",20460,"::1:16790",5ff202ad.4fec,1,"startup",2021-01-03 17:45:17 UTC,3/15493200,0,FATAL,28000,"role ""jose.villanova"" does not exist",,,,,,,,,"" ⇒ {"rule": "plain", "level": "info", "leveled": false, "message": "2021-01-03 17:45:17.612 UTC,\"jose.villanova\",\"postgres\",20460,\"::1:16790\",5ff202ad.4fec,1,\"startup\",2021-01-03 17:45:17 UTC,3/15493200,0,FATAL,28000,\"role \"\"jose.villanova\"\" does not exist\",,,,,,,,,\"\""}
2017-04-07 22:45:30.218 CEST [22603] postgres@mydb STATEMENT:  SELECT id, user FROM users WHERE NOT user @> %s ⇒ {"rule": "postgres", "level": "info", "leveled": false, "name": "", "message": "SELECT id, user FROM users WHERE NOT user @> %s"}
# constructed 2026-10-21 14:03:01 INFO server started ⇒ {"rule": "layout", "level": "info", "message": "server started"}
# constructed 2026-10-21 14:03:01.123 UTC [812] app ERROR:  a word without @ or = is not a prefix field ⇒ {"rule": "plain", "level": "info", "leveled": false, "message": "2026-10-21 14:03:01.123 UTC [812] app ERROR:  a word without @ or = is not a prefix field"}
