Awstats and remote syslog

  • Anonymous - 2008-04-03


    I've juste set up a new Linux box, wich is only a web frontal.

    The access and error Apache logs are deported on another box, with a remote syslog (very simply and common configuration, nothing special).

    But... I've got à "little" issue : in remote mode, syslog add some fieds at beach line of access.log, like this :

    Apr 3 06:47:52 logger: 81.57.220.xx - - [03/Apr/2008:06:47:52 +0200] "GET /feed/atom/ HTTP/1.1" 200 18334 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.9b4) Gecko/2008030714 Firefox/3.0b4"

    So, I've set up Awstats with a custom log format : LogFormat="%other %other %other %other %other %host %other %logname %time1 %methodurl %code %bytesd %refererquot %uaquot"

    But but but...

    As you can see, between Apr and 3, there is not only one space... but two !! It append only when the day number is smaller than 10.

    Of course, add two spaces between %other and %other doesn't work (too easy :) ).

    So... if you've got any idea to solve the issue, you're welcome :)

    Thanks ! (and yes, I know, my english is strange, I know :) )

    • Sid

      Sid - 2008-10-03

      I had this problem and used a simple Perl command on the logs before hand:

      /usr/bin/perl -pi -e 's/\s\s/ /g' log_name.log

    • Slick Willy

      Slick Willy - 2008-04-03

      Any LogFormat that you devise would need to change on the 10th of the month, wouldn't it?

      Run the log through sed to change the double space to a single space. Presto.

      • Anonymous - 2008-04-03

        Hum... there are no built-in solution, without calling an external program like sed ? (it's not a problem for me, just a question :) )

    • Slick Willy

      Slick Willy - 2008-04-03

      I don't know why awstats would build in a solution for a problem that isn't all that common.

      Are you using Apache's module to write to the remote syslog? Can the datestamp format be modified? That could be a solution.

  • jon mapp

    jon mapp - 2011-04-01


    I know this is a little out of date, but I've been searching for a solution to
    this for a few days and it can be done in the awstats.XXXXX.conf file directly
    the line is:

    LogFile="/bin/sed 's/ / /g' </tmp/apacheservers.log |"

    Obviously changing the location of your access log file to suit. Thanks to
    oustedaisse for the logformat solution though :-)


    • Dominik George

      Dominik George - 2015-06-08


      thank you for the hint. That saved my workday ☺!



Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks