From: Frédéric Marchal Date: Thu, 27 May 2010 18:51:45 +0000 (+0000) Subject: Accept the input files on the command line without the -l option X-Git-Tag: v2.3-pre5~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ed7127e337b49528ed4cc7cb5280c886921baf56;p=thirdparty%2Fsarg.git Accept the input files on the command line without the -l option --- diff --git a/ChangeLog b/ChangeLog index 31c3275..cffae2d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -45,6 +45,7 @@ May-27-2009 Version 2.3-pre4 - Accept unlimited line length when converting or splitting the log file. - Use long options on the command line. - Sarg can output the internal css inlined in the reports. It replaces the css.tpl distributed with the sources. + - Command line option -l is optional. The input log files may be named on the command line without prefixing them with -l. It allows the use of wildcards in the command line. Feb-10-2010 Version 2.2.7.1 - Fixed compilation error reported by some compilers due to an sizeof in a fprintf (thanks to Maxim Britov and Renato Botelho). diff --git a/log.c b/log.c index 4bfdc0f..f368219 100644 --- a/log.c +++ b/log.c @@ -504,6 +504,22 @@ int main(int argc,char *argv[]) exit(2); } + if (optind=MAXLOGS) { + debuga(_("Too many log files passed on command line.\n")); + exit(EXIT_FAILURE); + } + if (strlen(argv[iarq])>=MAX_LOG_FILELEN) { + debuga(_("Log file name too long passed on command line: %s\n"),argv[iarq]); + exit(EXIT_FAILURE); + } + strcpy(AccessLog[NAccessLog],argv[iarq]); + NAccessLog++; + AccessLogFromCmdLine++; + } + } + if(debug) debuga(_("Init\n")); if(ConfigFile[0] == '\0') snprintf(ConfigFile,sizeof(ConfigFile),"%s/sarg.conf",SYSCONFDIR); diff --git a/sarg.1 b/sarg.1 index 5ca38e5..f535e36 100644 --- a/sarg.1 +++ b/sarg.1 @@ -20,12 +20,13 @@ sarg \- Squid Analysis Report Generator .SH SYNOPSIS .B sarg .RI [ options ] +.I logfile... .SH DESCRIPTION \fBsarg\fP is a logfile parser and analyzer for the \fBSquid Web Proxy Cache\fP, which can be found at \fBhttp://www.squid-cache.org/\fP. This manual page documents briefly the .B sarg -command. More information is available at \fBhttp://sarg.sourceforge.net/\fP. +command. More information is available at \fBhttp://sarg.sourceforge.net/\fP. This manual page was originally written for the Debian distribution because the author didn't include one in favor of documentation in the GNU Info format; see below. @@ -39,8 +40,9 @@ IP Addresses, bytes, sites, and times. These HTML files can appear in your web server's directory for browsing by users or administrators. You may also have \fBsarg\fP email the reports to the Squid Cache administrator. .PP -\fBsarg\fP can take the \fBsquid\fP access log as its input, or optionally the -\fBsquidGuard http://www.squidguard.org/\fP Squid filter/redirector logfile format. +\fBsarg\fP can read \fBsquid\fP or \fBMicorosft ISA\fP access logs. Optionally, it can +complement the reports with the log of a Squid filter/redirector such as +\fBsquidGuard (http://www.squidguard.org/)\fP. .SH OPTIONS A summary of options is included below. .TP @@ -106,12 +108,17 @@ option in config file to contain "users_sites". .B \-l filename Uses .IR "filename" -as the input log. This option can be repeated up to 255 times to read multiple files. The files must be listed in chronological order from newest to eldest. If the files end with the extension +as the input log. This option can be repeated up to 255 times to read multiple files. The files must be listed in chronological order from newest to oldest. If the files end with the extension .IR ".gz" ", " ".bz2" " or " ".Z" they are decompressed. If the file name is just .I - , the log file is read from standard input. In that case, it cannot be compressed. + +This option is kept for compatibility with older versions of sarg but, starting with sarg 2.3, the log files may be named on the command +line without the +.B \-l +option. It allows the use of wildcards on the command line. Make sure you don't exceed the limit of 255 files. .TP .B \-L filename Reads a proxy redirector log file such as one created by squidGuard or Rejik. If you use this option, you may want to configure