darold / pgbadger

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

new data is not parsed #720

Closed kevser2761 closed 2 years ago

kevser2761 commented 2 years ago

Hi Darold

I am trying to parse and monitor logs from a remote server to a central pg_badger server with pg_badger as follows. However, after the first log file is read, new data added to the log file is not parsed by pg_badger.

pgBadger version 11.7

!/bin/bash

LOG_DIR=/data/dbcluster_name/11/data/log LOG_FILE=postgresql-(date +'%a').log REMOTE_PG=ssh://postgres@machine_ip:22 OUTDIR=/var/www/html/pg_reports_cluster_name/ /usr/bin/pgbadger -v --retention 2 -I -q $REMOTE_PG/$LOG_DIR/$LOG_FILE -O $OUTDIR -f stderr --prefix "[%m pid=%p] app=%a user=%u db=%d host=%h sessid=%c txid=%x" --rebuild

crontab-e 58 /2 /usr/bin/sh /var/lib/pgsql/badgersh/badger_cluster_name.sh >> /var/lib/pgsql/badgersh/badgerout.log 2>&1

fluca1978 commented 2 years ago

Could be similar to #723 , try adding -r machine_ip to your pgbadger invocation. This could cause the log to be read from the very beginning, but seems to work with version 11.7 and 11.6.

darold commented 2 years ago

@kevser2761 , as Luca mention this could be related to #723. I have just published a fix, please give a try to latest development code and confirm if it solves your issue.

darold commented 2 years ago

Commit 6a4750b fixes this issue.

kevser2761 commented 2 years ago

hi, ı tried with -r optıon and my pgbadger verison is 11.7 but ı stıll taking this error code in below and there are new data my log file

no new entries in your log(s) since last run.

fluca1978 commented 2 years ago

The issue should have been fixed, so it is worth getting the latest code out of the git repository and try it. Otherwise, please ensure you command line is like:

/usr/bin/pgbadger -v -r machine_ip  --retention 2 -I $LOG_DIR/$LOG_FILE -O $OUTDIR -f stderr --prefix "[%m pid=%p] app=%a user=%u db=%d host=%h sessid=%c txid=%x" --rebuild

and post the output if there are still problems. However, I encourage you to check out HEAD.