Обсуждение: log_destination = csvlog
Dear all, I've started collecting log information in CSV format, but I need a way to customize it. Problem is that I'm collecting slow statements, and the statements have \n (newline) character, and the piece of 2012-09-17 14:25:33.150 BRT,"thedb","thedb",15660,"10.10.20.1:33485",5054d3ab.3d2c,1,"SELECT",2012-09-15 16:14:51 BRT,10/204822,0,LOG,00000,"duração: 505.494 ms executar <unnamed>: select A, B from C join D on C.id = D.c_id And so on. It's not possible to change the application (hours of testing after changes will not be feasible for 2 million LOC). How can I tell PostgreSQL that it should remove the line breaks (and change them into whitespace character) from SQL statements? Or there is an "regexp" I can use for this purpose? Thanks, Edson
On Mon, Sep 17, 2012 at 04:20:14PM -0300, Edson Richter wrote: > Dear all, > > I've started collecting log information in CSV format, but I need a > way to customize it. > Problem is that I'm collecting slow statements, and the statements > have \n (newline) character, and the piece of > > 2012-09-17 14:25:33.150 BRT,"thedb","thedb",15660,"10.10.20.1:33485",5054d3ab.3d2c,1,"SELECT",2012-09-15 > 16:14:51 BRT,10/204822,0,LOG,00000,"duração: 505.494 ms executar > <unnamed>: select A, B > from C join D > on C.id = D.c_id > > And so on. > > It's not possible to change the application (hours of testing after > changes will not be feasible for 2 million LOC). > > How can I tell PostgreSQL that it should remove the line breaks (and > change them into whitespace character) from SQL statements? Or there > is an "regexp" I can use for this purpose? CSV parsers should handle this correctly. What tools are you trying to use? > > Thanks, > > Edson > -Ryan Kelly
Em 17/09/2012 16:32, Ryan Kelly escreveu: > On Mon, Sep 17, 2012 at 04:20:14PM -0300, Edson Richter wrote: >> Dear all, >> >> I've started collecting log information in CSV format, but I need a >> way to customize it. >> Problem is that I'm collecting slow statements, and the statements >> have \n (newline) character, and the piece of >> >> 2012-09-17 14:25:33.150 BRT,"thedb","thedb",15660,"10.10.20.1:33485",5054d3ab.3d2c,1,"SELECT",2012-09-15 >> 16:14:51 BRT,10/204822,0,LOG,00000,"duração: 505.494 ms executar >> <unnamed>: select A, B >> from C join D >> on C.id = D.c_id >> >> And so on. >> >> It's not possible to change the application (hours of testing after >> changes will not be feasible for 2 million LOC). >> >> How can I tell PostgreSQL that it should remove the line breaks (and >> change them into whitespace character) from SQL statements? Or there >> is an "regexp" I can use for this purpose? > CSV parsers should handle this correctly. What tools are you trying to > use? Please, do not kill me :-) : MS Excel, it does not handle it right, I know. Edson > >> Thanks, >> >> Edson >> > -Ryan Kelly > >
Em 17/09/2012 16:32, Ryan Kelly escreveu: > On Mon, Sep 17, 2012 at 04:20:14PM -0300, Edson Richter wrote: >> Dear all, >> >> I've started collecting log information in CSV format, but I need a >> way to customize it. >> Problem is that I'm collecting slow statements, and the statements >> have \n (newline) character, and the piece of >> >> 2012-09-17 14:25:33.150 BRT,"thedb","thedb",15660,"10.10.20.1:33485",5054d3ab.3d2c,1,"SELECT",2012-09-15 >> 16:14:51 BRT,10/204822,0,LOG,00000,"duração: 505.494 ms executar >> <unnamed>: select A, B >> from C join D >> on C.id = D.c_id >> >> And so on. >> >> It's not possible to change the application (hours of testing after >> changes will not be feasible for 2 million LOC). >> >> How can I tell PostgreSQL that it should remove the line breaks (and >> change them into whitespace character) from SQL statements? Or there >> is an "regexp" I can use for this purpose? > CSV parsers should handle this correctly. What tools are you trying to > use? > >> Thanks, >> >> Edson >> > -Ryan Kelly > > Actually, tried with Apache OpenOffice 3.4.1, and it works as expected. So, I just kicked Excel and now using OO. Regards, Edson.
On 18/09/12 08:45, Edson Richter wrote: > Em 17/09/2012 16:32, Ryan Kelly escreveu: >> On Mon, Sep 17, 2012 at 04:20:14PM -0300, Edson Richter wrote: >>> Dear all, >>> >>> I've started collecting log information in CSV format, but I need a >>> way to customize it. >>> Problem is that I'm collecting slow statements, and the statements >>> have \n (newline) character, and the piece of >>> >>> 2012-09-17 14:25:33.150 >>> BRT,"thedb","thedb",15660,"10.10.20.1:33485",5054d3ab.3d2c,1,"SELECT",2012-09-15 >>> 16:14:51 BRT,10/204822,0,LOG,00000,"duração: 505.494 ms executar >>> <unnamed>: select A, B >>> from C join D >>> on C.id = D.c_id >>> >>> And so on. >>> >>> It's not possible to change the application (hours of testing after >>> changes will not be feasible for 2 million LOC). >>> >>> How can I tell PostgreSQL that it should remove the line breaks (and >>> change them into whitespace character) from SQL statements? Or there >>> is an "regexp" I can use for this purpose? >> CSV parsers should handle this correctly. What tools are you trying to >> use? >> >>> Thanks, >>> >>> Edson >>> >> -Ryan Kelly >> >> > Actually, tried with Apache OpenOffice 3.4.1, and it works as > expected. So, I just kicked Excel and now using OO. > > Regards, > > Edson. > > Try LibreOffice, as it has replaced OpenOffice for most practical purposes! LibreOffice is up to version 3.6.1 with 3.6.2 out Real Soon Now (probably in a couple of weeks), it has many bug fixes, enhancements, and performance improvements over OpenOffice 3.4.1. http://www.libreoffice.org/ Cheers, Gavin