]> git.ipfire.org Git - thirdparty/sarg.git/commitdiff
Accept the input files on the command line without the -l option
authorFrédéric Marchal <fmarchal@users.sourceforge.net>
Thu, 27 May 2010 18:51:45 +0000 (18:51 +0000)
committerFrédéric Marchal <fmarchal@users.sourceforge.net>
Thu, 27 May 2010 18:51:45 +0000 (18:51 +0000)
ChangeLog
log.c
sarg.1

index 31c3275c6a2587d0fbdf87676a6fabd6472919fd..cffae2d3b275d18b552556884ff028f02a32f2bf 100644 (file)
--- 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 4bfdc0fa01dd941dbecd0e54041bd3c40e0d2e77..f3682193dd0f1d04b49705b3814233c70217e613 100644 (file)
--- a/log.c
+++ b/log.c
@@ -504,6 +504,22 @@ int main(int argc,char *argv[])
       exit(2);
    }
 
+   if (optind<argc) {
+      for (iarq=optind ; iarq<argc ; iarq++) {
+         if (NAccessLog>=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 5ca38e58ced232acdc96448b5d8c76f9309afc1f..f535e364edd78d4402b26a8ee99795adcb3cdc8d 100644 (file)
--- 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