Re: [GENERAL] Postgres csv logging

Поиск
Список
Период
Сортировка
От Alessandro_feliz
Тема Re: [GENERAL] Postgres csv logging
Дата
Msg-id 1500712084973-5972482.post@n3.nabble.com
обсуждение исходный текст
Ответ на Re: [GENERAL] Postgres csv logging  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-general
Hi David, thank you for your reply.

David G Johnston wrote
> As the comment there says your config and your output seem at odds.

What I showed was the output present in the csv log, the output in the text
file log has the prefix that I indicated in the configration file.

Either way, I managed to "solve" my problem, I started playing with the
logging configurations and managed to get it working. I still have no clue
why a thing so basic isn't correctly implemented.

In a simple way, what I wanted to do was to configure postgres so it would
log all the queries and respective types in a file, like this

"SELECT * FROM test","SELECT"
"INSERT INTO test (id, time) VALUES ('123','1-1-2010')","INSERT"
...

Now, when checking the official documentation regarding postgres logging, I
noticed that the csv format had all the information I needed
(https://www.postgresql.org/docs/9.4/static/runtime-config-logging.html#RUNTIME-CONFIG-LOGGING-CSVLOG)

In theory, logging to a csv file would give a lot of information that would
be usefull to me, return code, query, command tag, etc... In practice, most
of the columns are missing... Not very usefull at all. I started playing
with the logging configuration and managed to have an output that I can use.

By setting the next variables:

log_min_duration_statement = 0
log_statement = 'none'

I managed to create an output with the actual command tag of the query
instead of the word "idle". Funny part, if I change the setting
log_statement to anything else than none, all the command tags are set to
"idle"... As I already said, fields are missing, for instance, I have no
query... I had to use some regex to get it from the message field, but it
should be present in the respective column, but it isn't.

Again, this is something that seems very simple to do... and I thinks its
also very usefull. Worst part is that it is documented, so why is not
possible to do such a trivial task??





--
View this message in context: http://www.postgresql-archive.org/Postgres-csv-logging-tp5972017p5972482.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


В списке pgsql-general по дате отправления:

Предыдущее
От: Igor Korot
Дата:
Сообщение: Re: [GENERAL] Backward compatibility
Следующее
От: John McKown
Дата:
Сообщение: Re: [GENERAL] Backward compatibility