AWStats reading -n hours from a log file with - as delimiter

2013-12-23
2013-12-23
  • Igor Ljubuncic

    Igor Ljubuncic - 2013-12-23

    Hi guys,

    All is peachy but one thing.

    My logfiles look like log-%yyyy-%mm-%dd-%hh (I have no control here).

    If I specify this format, awstats can't find data, because the log files are created an hour back.
    So I need to use %HH-n to get the right hour. Unfortunately, with "-" as delimiter this does not work.

    Any suggestions how I could work around this and get awstats to parse delimiter and hour operator correctly at the same time. If the log delimiter was "_", it would have worked great, and the math for hours backward is correct.

    I tried concatenating strings. No luck. Or I'm not smart enough.

    I even considered adding a regex into awstats.pl to parse the log file and use a special delimiter instead of the real one and correct if after reading the conf file, but not quite sure if it's going to work. Or where exactly to tinker.

    Any suggestions?

    Igor

     
  • Albrecht Mueller

    Hi Igor,

    in my config file I have the following line:

    LogFile=cat "$(cat config/logFileList)" |
    

    The idea is to write the names of the logfiles into logFileList and let another cat write the contents of these files to a pipe from which AWStats will read it. This way I can specify different logfiles without touching the configuration file.

    I think you can use a similar technique to solve your problem: Instead of using cat you may use any unix tool like eg. sed or awk to bring your log file in a form AWStats is happy with.

    Regards

    Albrecht

     
  • Igor Ljubuncic

    Igor Ljubuncic - 2013-12-23

    Thanks. I was also thinking about simply tweaking the $starttime=time().
    Instead of taking "now", I could time()-7200 or so to get the right log files.
    I'll see if your methods works!

    Cheers,
    Igor

     

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

Sign up for the SourceForge newsletter:





No, thanks