Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Making postgresql logs in JSON format

Tags:

postgresql

I am using postgresql 9.5 on ubuntu 16.04.

Is there any way in postgresql so that it's logs can be stored in JSON format ?

I need to send it to elasticsearch, that's why I need to make postgresql logs in JSON format.

I followed this tutorial, but did not quite understood that what and where it was asking me to make changes in the conf file.

like image 382
Luv33preet Avatar asked Jan 22 '26 05:01

Luv33preet


1 Answers

PostgreSQL listens to their community and your voice is heard !

PostgreSQL 15 beta has been released on May 15th, 2022. PostgreSQL version 15 now supports the jsonlog logging format which is to be released in third quarter of 2022 .

You have to make the below change in the postgresql.conf file

log_destination = 'jsonlog'

The log output will be written to a file, making it the third type of destination of this kind, after stderr and csvlog.

You can send these generated json logs to elasticsearch or any application for further log aggergations.

Check here for more info

Update: PostgreSQL v15 is out now. You can now explore them here

like image 85
Jerry Avatar answered Jan 24 '26 23:01

Jerry



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!