3 #=======================================================================
5 # File ID: 1f845a80-5d39-11df-95dd-90e6ba3022ac
6 # Finner pauser mellom datoer på epoch-format.
9 # ©opyleft 2004– Øyvind A. Holm <sunny@sunbase.org>
10 # License: GNU General Public License, see end of file for legal stuff.
11 #=======================================================================
20 our ($opt_h, $opt_l, $opt_s) =
22 getopts
('hl:s') || die("Option error. Use -h for help.\n");
27 $progname =~ s
#^.*/(.*?)$#$1#;
37 if (/^.*?(\d+).*?$/) {
39 my $Pause = $Secs - $last_sec;
40 if ($last_sec && ($Pause >= $opt_l)) {
42 my @TA = gmtime($last_sec);
43 printf("%04u$d_sep%02u$d_sep%02u$dt_sep%02u$t_sep%02u$t_sep%02uZ\t$Pause\n",
44 $TA[5]+1900, $TA[4]+1, $TA[3], $TA[2], $TA[1], $TA[0]);
49 $Pause, sec_to_hms
($Pause)
55 print(STDERR
"Ukjent linje $.\n");
62 my ($Day, $Hour, $Min, $Sec) = (0, 0, 0, 0);
64 $Day = int($secs/86400);
67 $Hour = int($secs/3600);
68 $secs -= $Hour * 3600;
75 return(($Day ?
"$Day:" : "") . sprintf("%02u:%02u:%02u", $Hour, $Min, $Sec));
80 # Send the help message to stdout {{{
85 Usage: $progname [options] [file [...]]
87 Scans Apache access logs and prints out time periods with no connections.
92 -l x Show only pauses longer than x seconds.
101 # Plain Old Documentation (POD) {{{
107 ep-pause — find pauses in Apache logs
111 ep-pause [options] [file [...]]
123 Print a brief help summary.
127 Only list pauses longer than I<x> seconds.
137 Made by Øyvind A. Holm S<E<lt>sunny _AT_ sunbase.orgE<gt>>.
141 Copyleft © Øyvind A. Holm <sunny@sunbase.org>
142 This is free software; see the file F<COPYING> for legalese stuff.
146 This program is free software; you can redistribute it and/or modify it
147 under the terms of the GNU General Public License as published by the
148 Free Software Foundation; either version 2 of the License, or (at your
149 option) any later version.
151 This program is distributed in the hope that it will be useful, but
152 WITHOUT ANY WARRANTY; without even the implied warranty of
153 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
154 See the GNU General Public License for more details.
156 You should have received a copy of the GNU General Public License along
157 with this program; if not, write to the Free Software Foundation, Inc.,
158 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
166 # vim: set fenc=UTF-8 ft=perl fdm=marker ts=4 sw=4 sts=4 et fo+=w :
167 # End of file ep-pause