View radius logfile in browser...

mcdev
mcdev used Ask the Experts™
on
Hello.
I work for an ISP, and we want to give our tech support staff the ability to view failed logins thru NavisRadius over the web.

The logfile is at: /opt/Lucent/NavisRadius/run/navisradius.log

What I have done is made a page that displays the log in an inline frame. To display the log (thelog), I have made a script that runs via cron and parses the log and redirects the output to another file, which is then shown in the inline frame. Here's the script:

----------------------------------
tail -100r /opt/Lucent/NavisRadius/run/navisradius.log > /usr/local/apache/htdocs/thelog
sleep 10
tail -100r /opt/Lucent/NavisRadius/run/navisradius.log > /usr/local/apache/htdocs/thelog
sleep 10
tail -100r /opt/Lucent/NavisRadius/run/navisradius.log > /usr/local/apache/htdocs/thelog
sleep 10
tail -100r /opt/Lucent/NavisRadius/run/navisradius.log > /usr/local/apache/htdocs/thelog
sleep 10
tail -100r /opt/Lucent/NavisRadius/run/navisradius.log > /usr/local/apache/htdocs/thelog
sleep 10
----------------------------------

This is SUPPOSED to put the most recent 100 lines of the log file, containing the word 'failed' into my error page.
It does everything EXCEPT, it doesn't:
*refresh the logfile properly...the data is generally about an hour behind, then catches up a few times a day, then gets behind again.
*shows WAY more than the 100 last lines I would like it to show...not really sure how to make it recreate the file 'thelog'.

Thanks for any assistance you may offer.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2005

Commented:
That's really the wrong approach. You'd have much better luck writing a PHP or Perl web application that reads and parses the file each time a tech goes to your "log page". The code, if you roll your radius logs daily, should run acceptably fast and you can discard all but the last 100 failures.

Another, more complex, approach would be to write a Perl or C program that implements a named pipe that can be the target of the Radius log function. The code would keep a FIFO of the last 100 failed logins and write that to your "web page' each time the FIFO changes content. It would also write all log messages to the real log file. Since the log is important, you'd have to be very careful to get that application "right" and if written in Perl you should probably  stop and restart the code at least once a day to guard against memory leaks or other problems.

Commented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

PAQ  No refund

Please leave any comments here within the next four days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

liddler
EE Cleanup Volunteer
PAQed - no points refunded (of 200)

amp
Community Support Cleanup Moderator

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial