]> granicus.if.org Git - pgbadger/commitdiff
Add support to log timezones with + and - signs
authorjacksonfoz <jacksonfoz@gmail.com>
Fri, 19 Dec 2014 14:09:27 +0000 (12:09 -0200)
committerjacksonfoz <jacksonfoz@gmail.com>
Fri, 19 Dec 2014 14:09:27 +0000 (12:09 -0200)
pgbadger does not recognize log files (queries and events) with timezones like 'GMT+3'.

On postgresql.conf file the log_timezone variable is set as 'Etc/GMT+3' and lines are generated like this (stderr format):
2014-12-19 00:02:40 GMT+3 [1981]: [239-1] user=,db= LOG:  checkpoint starting: time

pgbadger

index c8b537aeba9c7fe609e143cb30dbff786328ad65..71b36f36be30854235d84a832b0a6d0a90bacf9b 100755 (executable)
--- a/pgbadger
+++ b/pgbadger
@@ -10677,7 +10677,7 @@ sub build_log_line_prefix_regex
                '%r' => [('t_hostport',     '([a-zA-Z0-9\-\.]+|\[local\]|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|[0-9a-fA-F:]+)?[\(\d\)]*')],     # remote host and port
                '%h' => [('t_client',       '([a-zA-Z0-9\-\.]+|\[local\]|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|[0-9a-fA-F:]+)?')],              # remote host
                '%p' => [('t_pid',          '(\d+)')],                                                        # process ID
-               '%t' => [('t_timestamp',    '(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})(?: [A-Z\d]{3,6})?')],      # timestamp without milliseconds
+               '%t' => [('t_timestamp',    '(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})(?: [A-Z\+\-\d]{3,6})?')],      # timestamp without milliseconds
                '%m' => [('t_mtimestamp',   '(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})\.\d+(?: [A-Z\d]{3,6})?')], # timestamp with milliseconds
                '%l' => [('t_session_line', '(\d+)')],                                                        # session line number
                '%s' => [('t_session_timestamp', '(\d{4}-\d{2}-\d{2} \d{2}):\d{2}:\d{2}(?: [A-Z\d]{3,6})?')],    # session start timestamp