darold / pgbadger

A fast PostgreSQL Log Analyzer
http://pgbadger.darold.net/
PostgreSQL License
3.56k stars 353 forks source link

Time difference #833

Open jayadevanm opened 2 months ago

jayadevanm commented 2 months ago

I am using pgBadger version 12.4. When I look at the Events tab, the charts seem to be getting the time period wrong. Clicking on Examples shows the correct/exact timestamp from the log file. The table section also seems to show a different time period. This is for an AWS RDS PG log file. The corresponding line from the log files says 2024-08-21 13:43:38 UTC:10.****ERROR: syntax error at end of input at character 44 In the chart as well as the table shows Hour as 18:00. pgbadger

darold commented 2 months ago

There is a pgbadger option for that:

    -Z | --timezone +/-XX  : Set the number of hours from GMT of the timezone.
                 Use this to adjust date/time in JavaScript graphs.
                 The value can be an integer, ex.: 2, or a float,
                 ex.: 2.5.

The timestamp in the graphs are always at the local timezone of the browser, you need to adjust it using the -Z option.

You can also change the timezone from the log before pgbadger start to parse the log by using the --log-timezone option:

    --log-timezone +/-XX   : Set the number of hours from GMT of the timezone
                 that must be used to adjust date/time read from
                 log file before being parsed. Using this option
                 makes log search with a date/time more difficult.
                 The value can be an integer, ex.: 2, or a float,
                 ex.: 2.5.