Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: counting yesterdays hits in a logfile

by space_monk (Chaplain)
on Nov 13, 2012 at 05:10 UTC ( #1003552=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use POSIX qw(strftime);
    
    $time= localtime(time-(24*60*60));
    $yesterday = strftime( '%d/%m/%y', $time);
    
  2. or download this
    `grep "$yesterday" logfile.log | wc -l`
    
  3. or download this
    open(LOGFILE,"<", "access.log")or die"Could not open log file.";
    my @logfile = <LOGFILE>
    my $hits = grep /$yesterday/, @logfile;
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1003552]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2014-12-28 11:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (180 votes), past polls