Thread: log statements span multiple lines
How do I tell postmaster to log SQL statements to a single line? At the moment, a particular statement gets chopped up across multiple syslog lines: Nov 28 06:28:31 guru postgres[5698]: [4-1] LOG: 00000: statement: SELECT mac, ip_addr, vlan, ad_ou, os_hostname, dns_hostname, Nov 28 06:28:31 guru postgres[5698]: [4-2] version_name, snmp_sys_descr, snmp_sys_objectid, wireless_ap, Nov 28 06:28:31 guru postgres[5698]: [4-3] switch_name, slot, port, first_seen, last_seen, last_updated FROM hosts LEFT JOIN switch_ports ON Nov 28 06:28:31 guru postgres[5698]: [4-4] hosts.switch_port = switch_ports.portid LEFT JOIN switches ON switch_ports.switch = switches.switchid LEFT JOIN os_versions ON Nov 28 06:28:31 guru postgres[5698]: [4-5] hosts.osver = os_versions.versionid WHERE ip_addr = '10.1.2.3' ORDER BY ip_addr ASC whereas I would prefer to see: Nov 28 06:28:31 guru postgres[5698]: [4-1] LOG: 00000: statement: SELECT mac, ip_addr, vlan, ad_ou, os_hostname, dns_hostname, version_name, snmp_sys_descr, snmp_sys_objectid, wireless_ap, switch_name, slot, port, first_seen, last_seen, last_updated FROM hosts LEFT JOIN switch_ports ON hosts.switch_port = switch_ports.portid LEFT JOIN switches ON switch_ports.switch = switches.switchid LEFT JOIN os_versions ON hosts.osver = os_versions.versionid WHERE ad_ou IS NOT NULL ORDER BY ip_addr ASC Nov 28 06:28:32 guru {some other log message} --sk Stuart Kendrick FHCRC
Stuart Kendrick <skendric@fhcrc.org> writes: > How do I tell postmaster to log SQL statements to a single line? Don't use syslog. > At the moment, a particular statement gets chopped up across multiple > syslog lines: The reason for this is that many syslog implementations have arbitrary limits on line lengths, and will drop or corrupt data beyond that. If you know what the limit is on your particular platform, you could adjust the chopping-point constant in elog.c. (I would not recommend disabling the chopping behavior altogether.) But on the whole it's probably better to switch to another logging method. regards, tom lane
Hi Tom, Ah, I see. For the moment, I've bumped PG_SYSLOG_LIMIT from 128 to 1024 Thank you, --sk On 11/28/2010 8:54 AM, Tom Lane wrote: > Stuart Kendrick<skendric@fhcrc.org> writes: >> How do I tell postmaster to log SQL statements to a single line? > > Don't use syslog. > >> At the moment, a particular statement gets chopped up across multiple >> syslog lines: > > The reason for this is that many syslog implementations have arbitrary > limits on line lengths, and will drop or corrupt data beyond that. > > If you know what the limit is on your particular platform, you could > adjust the chopping-point constant in elog.c. (I would not recommend > disabling the chopping behavior altogether.) But on the whole it's > probably better to switch to another logging method. > > regards, tom lane