One issue I haven't seen mentioned in this thread is the translation status of the server message (as well as its encoding): it's possible to receive messages in some random language if the lc_message setting is changed. Requiring that lc_messages must always be set to some English locale seems like a poor answer to this problem. IMO the untranslated server message should be part of the event also. I don't know what to think of %-expansions of the message.
The character encoding can be changed per database. Log files where the encoding differs across databases cannot be processed in any sane way. You can try some heuristics (try to read each message as utf8 first, and if that fails, then it must be Latin1! If that doesn't work for you, ... tough luck), but that's a pretty poor answer too. Not sure what is a good solution to this problem. Maybe ensure that these things are always UTF8? -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services