Import old apache access logs to webalizer - ignoring records

2.2k Views Asked by At

I installed webalizer on my apache 2 webserver yesterday and came across the problem, that all the old access logs are not used. The directory list looks like that:

/var/log/apache2/

access.log
access.log1
access.log.10.gz
access.log.11.gz
...

How can I import all my files at once?

I tried several things, but it was telling me, that the records were ignored.

Hope somone can help. Thanks!

2

There are 2 best solutions below

0
On

I ran into the same problem. I had just installed webalizer, and changed it to incremental mode (here are the relevant entries from my /etc/webalizer/webalizer.conf):

LogFile /var/log/apache2/access.log.1
OutputDir /var/www/htdocs/w
Incremental     yes
IncrementalName webalizer.current

And then I ran webalizer by hand, which initialized the non-gz files in my logs directory. After that, any attempt to manually import an older gz logfile (by running webalizer /var/log/apache2/access.log.2.gz for instance) resulted in all of the entries being ignored.

I suspect this is because the entries found in the gz logs were older than the last import- I had to delete my webalizer.current file (really I cleared the whole dir- either way should work). Finally, in reverse order (oldest first), I could import the old gz files one at a time:

bhs128@home:~$ cd /var/log/apache2
bhs128@home:/var/log/apache2$ sudo rm -rf /var/www/htdocs/w/*
bhs128@home:/var/log/apache2$ ls -1t /var/log/apache2/access.log*gz | grep -o [0-9]* | tail -n1
52
bhs128@home:/var/log/apache2$ for i in {52..2}; do webalizer /var/log/apache2/access.log.$i.gz; done
0
On

I just had the same problem, and I took a look into the webalizer.current file:

$ head -n 2 webalizer.current
# Webalizer V2.21-02 Incremental Data - 11/05/2019 22:29:02
2019 11 5 22 29 2

The second line seems to contain the timestamp of the last run, so I just changed the year to 2018. After that, I was able to import older log files than the last imported ones, without having to delete all the data first.