Analog with Report Magic and Logwrangler

I am now using Report Magic for Analog with my Analog installation.  My last attempt had failed miserably, but this time it went extremely well.  I found Logwrangler which does a lot of the work.  I encountered an incompatibility between Report Magic and an updated graphics library.  Once the patch was applied the program ran well.  All that was left was tuning the report layout and the interaction with Logwrangler.

This installation builds on my existing analog setup. This is outlined in  Analog for Multiple Sites.  Please get that setup working before attempting this configuration.

Setting up Logwrangler

I downloaded the Logwrangler package from http://www.reppep.com/~pepper/analog/logwrangler/. This was untarred in the home directory of the user I had been using logwrangler.pl needed to be updated to find the analog and rmagic binaries. I also updated it to place the rmagic.ini in the Logwrangler subdirectory.  This is a patch to apply the changes.

--- logwrangler.pl.orig 2010-04-29 22:41:28.000000000 -0400
+++ logwrangler.pl      2010-05-12 00:04:24.000000000 -0400
@@ -16,3 +16,3 @@
 # logs for DNSTran to process
-my $analog = ("/usr/local/bin/analog");
+my $analog = ("/usr/bin/analog");
 # analog binary
@@ -20,3 +20,3 @@
 # directory containing Analog configuration files
-my $rmagic = "/usr/local/reportmagic/rmagic.pl";
+my $rmagic = "/usr/bin/rmagic";
 # path to rmagic.pl
@@ -86,3 +86,3 @@
                        if ($verbosity > 0) { print "$site "; }
-               @args = ("$rmagic", "-statistics-File_In=$datapath/$site", "-reports-File_Out=$outputpath/$sitepath/index.html");
+               @args = ("$rmagic", "$basedir/rmagic.ini", "-statistics-File_In=$datapath/$site", "-reports-File_Out=$outputpath/$sitepath/");
                # if your rmagic.pl can't find rmagic.ini, you can add the full path as the second member of the list above

logtable.pl will need be copied or moved to ~/bin as logwrangler.pl will look for it there.

Setting up Report Magic

Report magic is available as a package for Ubuntu. Installed this version. Copy /usr/share/doc/rmagic/examples/samples/reportmagic-org.ini to ~/logwrangler/rmagic.ini. This is a starting configuration for rmagic.

The installed /usr/share/rmagic/wadg/rm/Setting.pm will fail when it creates a 0x0 Image. It needs to be patched at line 910 as follows.

--- Settings.pm.orig    2010-05-12 00:33:55.000000000 -0400
+++ Settings.pm 2010-05-12 00:34:20.000000000 -0400
@@ -909,3 +909,3 @@
        #
-       my $g = new GD::Image(0,0);
+       my $g = new GD::Image(1,1);

You may also want to link the images in /usr/share/

Integrating the Existing Analog Setup

Create etc/rmagic.inc.  It will need to change the output format to computer, and turn off all the graphics which are on

# etc/rmagic.inc - report magic specific overrides of common configuration/
# Change output format
OUTPUT   COMPUTER

# Turn of graphics
DOMCHART OFF
ORGCHART OFF
SEARCHWORDCHART OFF
BROWSUMCHART OFF
OSCHART OFF
STATUSCHART OFF
PROCTIMECHART OFF
VHOSTCHART OFF
REDIRVHOSTCHART OFF
FAILVHOSTCHART OFF
INTSEARCHQUERYCHART OFF
INTSEARCHWORDCHART OFF
USERCHART OFF
REDIRUSERCHART OFF
FAILUSERCHART OFF

Create the directories ~/logwranger/cfg and ~/logwrangler/data.  Copy ~/etc/example_week.conf to the new cfg directory.  Remove both the CHARTDIR and LOCALCHARTDIR parameters.  Change the OUTFILE to logwrangler/data/example-week.txt.  (NOTE: underscores need to be replaced by hyphens.)  Finally add a CONFIGFILE for etc/rmagic.inc at the end.  It should now read:

# example_month.conf
HOSTNAME "Example.com - Month"
OUTFILE logwranger/data/example-month.txt

CONFIGFILE etc/common_month.inc
CONFIGFILE etc/example_vhost.inc
CONFIGFILE etc/log_month.inc
CONFIGFILE etc/rmagic.inc

Run logwrangler/logwrangler.pl from your home directory.  Analog should generate output in ~/logwrangler/data.  Report Magic should then convert this to a report in ~logwrangler/stat.  Link ~logwrangler/stat into your web-server directory.

Tuning the Output

The analog reports generated can be tuned by turning them on or off in the etc/rmagic.inc file.

If you have a number of report sets you may want to add a footer which navigates from the reports back to the reports menu.  Create ~/logwrangler/footer.html containing.

<!-- logwrangler/footer.html -->
<center><a href="../index.html" target="_top" name="Return to Report menu">
<b>Return to Report menu</b></a><br /></center>

Now change ~/logwranger/rmagic.ini so that the website section includes:

Company_Logo = logwrangler/footer.html

Review the Report Magic for Analog documentation. You may want to consider these changes:

  • update statistics section commenting out Reverse_Time = 1;
  • update statistics section adding No_Robots = 1; and
  • updating quick section to change the Rows list.

Implementing More Reports

Copy the remaining .conf files from ~/etc to ~/logwrangler/cfg.  Apply the same edits that were done to the original file.  These are:

  • Remove both the CHARTDIR and LOCALCHARTDIR parameters;
  • Change the OUTFILE directory path to logwrangler/data/;
  • Change the OUTFILE filename replacing underscores with hyphens;
  • Change the OUTFILE file extension to .txt; and
  • Add a CONFIGFILE for etc/rmagic.inc at the end

If you haven’t already done so, copy or link ~/logwrangler/logtable.pl to ~/bin. This program builds an index file for the reports that have been generated.

Setup a cronjob to run ${HOME}/logwrangler/logwrangler.pl -q. Run ${HOME}/logwrangler/logwrangler.pl -v to verify all your configuration files.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Cookie Consent with Real Cookie Banner