dklab_logreplica
dklab_logreplica copied to clipboard
Extra characters in logs
It seems it inserts ==> <==
into logs after sync. Can't find documentation about it and how to avoid it..?
It looks like a bug. Should not insert something like that.
Could you please help to reproduce? Do you have a minimal set of files/commands to reproduce?
On Monday, November 17, 2014, Victor Efimov [email protected] wrote:
It seems it inserts ==> <== into logs after sync. Can't find documentation about it and how to avoid it..?
— Reply to this email directly or view it on GitHub https://github.com/DmitryKoterov/dklab_logreplica/issues/1.
It looks like a bug. Should not insert something like that.
That's strange. I was thinking it's a feature, because there is code to insert that https://github.com/DmitryKoterov/dklab_logreplica/blob/master/dklab_logreplica.pl#L485 https://github.com/DmitryKoterov/dklab_logreplica/blob/master/dklab_logreplica.pl#L499
Maybe incompatible with a log rotation or something?
Could you please help to reproduce?
We need to think how to minimize it to PoC..
The code you mention is just a part of the protocol implementation to communicate between remote and local parts. This code multiplexes data flows from different log files into a single stream.
The protocol looks similar to the output format used by "tail -f /var/log/*" command.
On Monday, November 17, 2014, Victor Efimov [email protected] wrote:
It looks like a bug. Should not insert something like that.
That's strange. I was thinking it's a feature, because there is code to insert that https://github.com/DmitryKoterov/dklab_logreplica/blob/master/dklab_logreplica.pl#L485 https://github.com/DmitryKoterov/dklab_logreplica/blob/master/dklab_logreplica.pl#L499
Maybe incompatible with a log rotation or something?
Could you please help to reproduce?
We need to think how to minimize it to PoC..
— Reply to this email directly or view it on GitHub https://github.com/DmitryKoterov/dklab_logreplica/issues/1#issuecomment-63352112 .
Добрый день. Такая ситуация возникает, когда в лог файл в конец строки записывается \n с некоторой задержкой. Это поведение можно повторить, если создать лог файл и писать в него руками отдельно текст, запись, \n, запись. Чтобы это исправить можно в код между строк 476 и 478 вставить: if ( !m/^[^\n]*\n/s ){ sleep(0.1); next; } А также в шапку добавить: use Time::HiRes;
Thanks, I'll try to reproduce and fix soon.
@vmironenko 's fix helped us. thanks.