xorl has asked for the wisdom of the Perl Monks concerning the following question:
I'm crunching some web logs. However we've got two boxes (one an IIS and the other an Apache server). In order for our analysis tool to give us info, the logs have to be combined and sorted.
So right now I've got a perl script which pulls the logs from each box, combines them into one giant log, and puts that in the watch directory of the analysis software.
The problem is we only do this once a month and the combing step takes a while. I'd like to let the user know that something is actually happening and give them an idea of the progress. Here's the section of the
The only way I can think of making a progress bar for this, is to pull it all into perl. The basic outline would be something like:my $cmd = "cat /tmp/win.log /tmp/lnx.log | grep -v "/" . $nextmonth . +"/" | sort -k4.2 > /export/w3logs/" . $year . $month . ".log"; system($cmd);
open the log files and the output file. read in each log file into a hash with the key based on the date of th +e item sort the hash keys and write the values to the output file
Now from previous experience I know the above outline will be a lot slower than how it is being done now. Also to note, we're talking about 2-4 Gb logfiles.
Is there a faster way of doing this or there some way to make a progress bar and still use the system call?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: progress bar for a system command
by zentara (Cardinal) on Jul 19, 2007 at 16:12 UTC | |
|
Re: progress bar for a system command
by Fletch (Bishop) on Jul 19, 2007 at 15:36 UTC | |
|
Re: progress bar for a system command
by duelafn (Parson) on Jul 19, 2007 at 15:50 UTC | |
|
Re: progress bar for a system command
by dsheroh (Monsignor) on Jul 19, 2007 at 17:13 UTC |