I've got multiple access logs in the logs directory, following the naming convention below:
access.log.1284642120
access.log.1284687600
access.log.1284843260
Basically, the logs are "rotated" by Apache per day, so they can be sorted in order.
I am trying to "read them one after another", so that they can be treated as one log file.
my @logs = glob('logs/access.log.*');
The above code will glob all the logs, but I am not sure:
- In which order will the logs be organized, alphabetically?
- if I want to check "the latest access time from an unique IP", how could I do this?
I have a Perl script that can read a single access log and check this easily (my algorithm is to have a big hash which uses IP address as the key and the access time as the value, and just keep pushing key/value pairs to it...). But I don't want to just merge all access files into one temporary file just for this process.
Any suggestions? Many thanks in advance.