darold / pgbadger

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

Empty report, queries=0, same syslog postgres log , upgrade pgbadger from 8.1 to 12.4 #822

Closed aandalou closed 7 months ago

aandalou commented 7 months ago

Hello Gilles,

I encounter a strange case, with pgbadger, when i upgrade from 8.1 to 12.4 :

Under 8.4 LANG=en_US perl pgbadger --verbose --prefix '%c - %l %a user=%u,db=%d,host=%h,pid=%p ' syslog-xxxxx.log -f syslog -o syslog-test.html 2> out.log

on out.log everything is ok (queries: 7094) =>

DEBUG: Unrecognized line: LOG: duration: 1.694 ms statement: at line 11575 DEBUG: Unrecognized line: LOG: duration: 1.610 ms execute : at line 11587 DEBUG: Unrecognized line: LOG: duration: 5.087 ms statement: at line 11599 DEBUG: Unrecognized line: LOG: duration: 1.260 ms statement: at line 11610 DEBUG: Unrecognized line: LOG: duration: 4.055 ms statement: at line 11637 DEBUG: Unrecognized line: LOG: duration: 5.915 ms execute : at line 11642 DEBUG: Unrecognized line: LOG: duration: 1.792 ms execute : at line 11646 DEBUG: Unrecognized line: LOG: duration: 3.929 ms statement: at line 11674 DEBUG: Unrecognized line: LOG: duration: 1.460 ms statement: at line 11680 DEBUG: Unrecognized line: LOG: duration: 2.367 ms execute : at line 11684 [========================>] Parsed 3224416 bytes of 3224416 (100.00%), queries: 7094, events: 0^M

my report shows results.

log_line_prefix of my instance => '%c - %l %a user=%u,db=%d,host=%h,pid=%p'

My postgres format log is :

Apr 4 03:37:42 dbserver postgresql-promohd[1147284]: [645-1] 660dfd4d.118194 - 628 PostgreSQL JDBC Driver user=user_ddc_player_promohd,db=ddc_player_promohd,host=lx21986.prf.fdj.fr,pid=1147284 LOG: duration: 3.298 ms execute S_8/C_1033: select * from outbox_events_transactions_p2 limit 1 for update skip locked

I re-execute the same command, but with pgbadger 12.4 ( last release ), ihave these logs :

DEBUG: Unknown syslog line format: Apr 4 03:37:12 lx53003 postgresql-promohd[23310]: [380090-3] #011 FROM fdjtools.v_drita_system_waits; DEBUG: Unknown syslog line format: Apr 4 03:37:12 lx53003 postgresql-promohd[23310]: [380090-4] DEBUG: Unknown syslog line format: Apr 4 03:37:12 lx53003 postgresql-promohd[23313]: [337630-2] #011 SELECT COUNT(mode) AS count, mode DEBUG: Unknown syslog line format: Apr 4 03:37:12 lx53003 postgresql-promohd[23313]: [337630-3] #011 FROM pg_locks l JOIN pg_database d ON (d.oid=l.database) DEBUG: Unknown syslog line format: Apr 4 03:37:12 lx53003 postgresql-promohd[23313]: [337630-4] #011 WHERE d.datname=$1 DEBUG: Unknown syslog line format: Apr 4 03:37:12 lx53003 postgresql-promohd[23313]: [337630-5] #011 GROUP BY mode DEBUG: Unknown syslog line format: Apr 4 03:37:12 lx53003 postgresql-promohd[23313]: [337630-6] #011 UNION DEBUG: Unknown syslog line format: Apr 4 03:37:12 lx53003 postgresql-promohd[23313]: [337630-7] #011 SELECT COUNT(*) AS count, 'waiting' AS mode DEBUG: Unknown syslog line format: Apr 4 03:37:12 lx53003 postgresql-promohd[23313]: [337630-8] #011 FROM pg_locks l JOIN pg_database d ON (d.oid=l.database) DEBUG: Unknown syslog line format: Apr 4 03:37:12 lx53003 postgresql-promohd[23313]: [337630-9] #011 WHERE granted is false DEBUG: Unknown syslog line format: Apr 4 03:37:12 lx53003 postgresql-promohd[23313]: [337630-10] #011 AND d.datname=$1; DEBUG: Unknown syslog line format: Apr 4 03:37:12 lx53003 postgresql-promohd[23313]: [337630-11] [========================>] Parsed 3224416 bytes of 3224416 (100.00%), queries: 0, events: 0^M

Report is empty with queries: 0 at end of the log.

Note : I try also command with -f syslog2, but the same problem. I try also with log_line_prefix without pid => '%c - %l %a user=%u,db=%d,host=%h ' [change on postgres server + prefix option when pgbadger invoking], because syslog have already pid => same problem

Thanks in advance for your review

I'm available for more information

Adil

darold commented 7 months ago

You need to append -i 'postgresql-promohd' to you pgbadger command. If the syslog ident name is not postgresql you must set it at command line, this is to avoid parsing lines that are not related to PostgreSQL.

aandalou commented 7 months ago

Thank you for your support and quick response. I tried with -i 'postgresql-promohd', it's ok now. Thank you so much

aandalou commented 7 months ago

OK