postgresql pgbadger error - can not load incompatible binary data, binary file is from version < 4.0

730 Views Asked by At

I am trying to use pgbadger to make html report for postgres slow query log files. My postgres logfiles are in csvlog format in folder pg_log. I transfer all logfiles (80 files with 10 MB each) to my local windows machine and trying to generate single html report for all files. I created all one file from all files in below way,

type postgresql-2020-06-18_075333.csv > postgresql.csv
type postgresql-2020-06-18_080011.csv >> postgresql.csv
....
....
type postgresql-2020-06-18_094812.csv >> postgresql.csv

I downloaded "pgbadger-11.2" and tried below command but getting error.

D:\pgbadger-11.2>perl --version
This is perl 5, version 28, subversion 1 (v5.28.1) built for MSWin32-x64-multi-thread

D:\pgbadger-11.2>perl pgbadger "D:\June-Logs\postgresql.csv" -o postgresql.html
[========================>] Parsed 923009530 bytes of 923009530 (100.00%), queries: 1254764, events: 53
can not load incompatible binary data, binary file is from version < 4.0.
LOG: Ok, generating html report...

postgresql.html is created but no data in any tab.But it works when i create separate report for individual csv. like below.

D:\pgbadger-11.2>perl pgbadger "D:\June-Logs\postgresql-2020-06-18_075333.csv" -o postgresql-2020-06-18_075333.html
D:\pgbadger-11.2>perl pgbadger "D:\June-Logs\postgresql-2020-06-18_080011.csv" -o postgresql-2020-06-18_080011.html
...
D:\pgbadger-11.2>perl pgbadger "D:\June-Logs\postgresql-2020-06-18_094812.csv" -o postgresql-2020-06-18_094812.html

Please suggest me something to fix this issue.

1

There are 1 best solutions below

3
On

I going to say this due to:

type postgresql-2020-06-18_075333.csv > postgresql.csv
type postgresql-2020-06-18_080011.csv >> postgresql.csv

Pretty sure that is introducing Windows line endings and pgBadger is looking for Unix line endings. Can you do the concatenate on the server?

UPDATE. Hmm. Ran across this

https://github.com/darold/pgbadger/releases

"This new release breaks backward compatibility with old binary or JSON files. This also mean that incremental mode will not be able to read old binary file [...] Add a warning about version and skip loading incompatible binary file.

  • Update code formatter to pgFormatter 4.0."

Not sure why it is failing on CSV logs, still what is version of pgBadger generating logs?