Perl: the Markov chain saw | |
PerlMonks |
Re: storing data in a hashby shmem (Chancellor) |
on Jun 22, 2006 at 16:04 UTC ( [id://556930]=note: print w/replies, xml ) | Need Help?? |
From what you write it is not very clear to me what you want to do.
Does the log file span a day change? If so, is it, that given queries reflected in the logfile as for the following graph you want to divide the data amount between the days and sum them up foreach date? Or is the the logfile always either one day or the other? In either case, use Time::Local. When does the script run? I assume the script runs roughly at any time between 20:30:00 and 03:00:00. Make a UNIX timestamp of the day change with Then you can compare the timestamp in the second field of your rows to that timestamp and sum it to the right day sum: Voila, you have the sum of one day in $sum{'first'} and of the next day in $sum{'second'}, now you can insert into your database whichever of the two contains data. If the log file spans days, you could split the amount of bytes according to the second before and after a days shift foreach row.
cheers, _($_=" "x(1<<5)."?\n".q·/)Oo. G°\ / /\_¯/(q / ---------------------------- \__(m.====·.(_("always off the crowd"))."· ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
In Section
Seekers of Perl Wisdom
|
|