Novell Home

Parsing and Posting NBM Proxy Log Files to Apache

Novell Cool Solutions: Tip

Digg This - Slashdot This

Posted: 26 Jan 2005
 

Now you can automatically pull BorderManager Proxy logs into an Apache folder, thanks to this tip from Cool Solutions reader Kevin Heide. Here's how he did it:

Problem

I needed to find an automated process to parse BorderManager Proxy log files and post the HTML data to an Apache webserver, running on Novell SUSE Linux Enterprise Server 9. However, the available programs I looked at were either not open-source, or they were designed for Windows-based systems.

Solution

Here's what I did to solve the problem:

  1. I downloaded two popular freeware programs - brdstats.exe from http://nscsysop.hypermart.net/brdstats.html and dosemu from http://dosemu.org
  2. Using these programs, I wrote scripts and a CRON job to parse the daily logs and copy them to an apache folder.

The first part of the process is to get the log files from the BorderManager server. This was accomplished by running a simple FTP CRON job.

The second part of this process is getting brdstats to run on Linux. This is accomplished using the dosemu utility. I used a standard DOS batch file and utilities within dosemu to map drive letters to the linux file server. Then when the autoexec.bat file runs in the virtual environment, it parses the log files, creates the .htm files needed for the web page and copies them to the webserver location. However, there are some issues with case- sensitive file names, so I had to rename files as part of this step (just using a simple rename command). However, I am not a Linux scripting guru, so I also had to add index.HTM as a default web page so Apache would pick it up.

Example

Here's a sample autoexec.bat file that does the work:
lredir p: linux\fs\brdstats #Location of logs and brdstats.exe
lredir w: linux\fs\srv\www\htdocs *location of html pages for apache

brdstats.sh #Script for cron job to run
dosemu.bin -I 'video { none }' #allows dosemu to run without video
sleep 5 #pause to ensure clean exit
cd /srv/www/htdocs/bm2
rename .htm .HTM *.htm # Rename files copied within DOS Windows

As I said, I am not a linux scripting expert, and there may be cleaner and more efficient methods of doing this process. Still, this helped us automate our log file retrieval in BorderManager.

Editor's note: Linux scripting gurus - we're waiting to hear from you if you have a cool script that addresses this (or similar) problems.


Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

© 2014 Novell