Demo Discussion
Forum Config Examples Contributions Vulnerabilities
  Contributions to ELOG  Not logged in ELOG logo
Entry   Check logbook files for wrong references, posted by Andreas Luedeke on Fri Sep 15 17:19:47 2017 logcheck
    Reply   Re: Check logbook files for wrong references, posted by David Pilgram on Sat Sep 16 15:47:16 2017 
Message ID: 53     Entry time: Sat Sep 16 15:47:16 2017     In reply to: 52
Author: David Pilgram 
Author Email: David.Pilgram@epost.org.uk 
Category: Script 
Subject: Re: Check logbook files for wrong references 
Status: Stable 
Last Revision: Sat Sep 16 15:52:58 2017 by David Pilgram 

I had to modify the script because I'm still on elog 2.9.2, where there are not subdirectories (by year) for
 each logbook.  Line 5 had to be changed to  

$logf=q/[0-9][0-9][01][0-9][0-3][0-9]a.log/;

to do this.

Once done, I found the deliberate orphan script that I had put in to test, and rather too many other orphans than I had expected.  One or two I cannot explain.   If I had clicked on any of those entries elog would have gone into infinate loop.

A very useful utility.  Thanks Andreas!

Andreas Luedeke wrote:
You can run this little script to check if all entries referenced "In reply to:" do actually exist.
To use it, you first need to "cd" to your logbook directory ("cd /usr/local/elog/logbooks") and then run it without arguments "logcheck".
If it finds references pointing to a missing entry, it'll print the path to the file with the offending reference and some lines. For example:
### error: reference to entry 146, that exists 0 times. Reference is:
### Proscan/2012/120507a.log-<p>[...].</p>
### Proscan/2012/120507a.log-$ @ MID @ $: 147
### Proscan/2012/120507a.log-Date: Mon, 07 May 2012 13:44:03 +0200
### Proscan/2012/120507a.log:In reply to: 146
### Proscan/2012/120507a.log-Wann: 1336373261
### Proscan/2012/120507a.log-Autor: [...]
### Proscan/2012/120507a.log-Eintrag: Problem
[...]-

Very often this happens if an entry is deleted AFTER someone already replied to it. Normally that is no problem, but in some cases you might get infinite loops and that causes ELOG to hang. The script is not checking for loops, but wrong references might give you a hint where to look.

The script will print duplicate entries as well, if the referenced entry exist more than once.

Cheers, Andreas

PS: never include the string "$ @ MID @ $:" without spaces in an ELOG entry: apparently ELOG cuts off all text from that token on.

 

ELOG V3.1.5-fe60aaf