diff options
author | Michael Paquier <michael@paquier.xyz> | 2022-01-17 10:16:53 +0900 |
---|---|---|
committer | Michael Paquier <michael@paquier.xyz> | 2022-01-17 10:16:53 +0900 |
commit | dc686681e0799b12c40f44f85fc5bfd7fed4e57f (patch) | |
tree | 66654ff9d34f4153810245c2152a6d2ddfbeb761 /src/backend/utils/misc/postgresql.conf.sample | |
parent | 6478896675660402171c97d6307e6e1519250025 (diff) | |
download | postgresql-dc686681e0799b12c40f44f85fc5bfd7fed4e57f.tar.gz postgresql-dc686681e0799b12c40f44f85fc5bfd7fed4e57f.zip |
Introduce log_destination=jsonlog
"jsonlog" is a new value that can be added to log_destination to provide
logs in the JSON format, with its output written to a file, making it
the third type of destination of this kind, after "stderr" and
"csvlog". The format is convenient to feed logs to other applications.
There is also a plugin external to core that provided this feature using
the hook in elog.c, but this had to overwrite the output of "stderr" to
work, so being able to do both at the same time was not possible. The
files generated by this log format are suffixed with ".json", and use
the same rotation policies as the other two formats depending on the
backend configuration.
This takes advantage of the refactoring work done previously in ac7c807,
bed6ed3, 8b76f89 and 2d77d83 for the backend parts, and 72b76f7 for the
TAP tests, making the addition of any new file-based format rather
straight-forward.
The documentation is updated to list all the keys and the values that
can exist in this new format. pg_current_logfile() also required a
refresh for the new option.
Author: Sehrope Sarkuni, Michael Paquier
Reviewed-by: Nathan Bossart, Justin Pryzby
Discussion: https://postgr.es/m/CAH7T-aqswBM6JWe4pDehi1uOiufqe06DJWaU5=X7dDLyqUExHg@mail.gmail.com
Diffstat (limited to 'src/backend/utils/misc/postgresql.conf.sample')
-rw-r--r-- | src/backend/utils/misc/postgresql.conf.sample | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample index a1acd46b611..817d5f53246 100644 --- a/src/backend/utils/misc/postgresql.conf.sample +++ b/src/backend/utils/misc/postgresql.conf.sample @@ -432,14 +432,15 @@ # - Where to Log - #log_destination = 'stderr' # Valid values are combinations of - # stderr, csvlog, syslog, and eventlog, - # depending on platform. csvlog - # requires logging_collector to be on. + # stderr, csvlog, jsonlog, syslog, and + # eventlog, depending on platform. + # csvlog and jsonlog require + # logging_collector to be on. # This is used when logging to stderr: -#logging_collector = off # Enable capturing of stderr and csvlog - # into log files. Required to be on for - # csvlogs. +#logging_collector = off # Enable capturing of stderr, jsonlog + # and csvlog into log files. Required + # to be on for csvlogs and jsonlogs. # (change requires restart) # These are only used if logging_collector is on: |