if(arq[0] == '\0')
arq="/var/log/squid/access.log";
- if((fp_in=MY_FOPEN(arq,"r"))==NULL) {
+ if (arq[0]=='-' && arq[1]=='\0') {
+ fp_in=stdin;
+ } else if((fp_in=MY_FOPEN(arq,"r"))==NULL) {
debuga(_("(convlog) Cannot open log file %s - %s\n"),arq,strerror(errno));
exit(EXIT_FAILURE);
}
}
longline_destroy(&line);
- if (fclose(fp_in)==EOF) {
+ if (fp_in!=stdin && fclose(fp_in)==EOF) {
debuga(_("Failed to close file %s - %s\n"),arq,strerror(errno));
}
}
'\" t
.\" Title: sarg
.\" Author: Frédéric Marchal <fmarchal@users.sourceforge.net>
-.\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
.\" Date: 27 May 2012
.\" Manual: SARG
.\" Source: sarg
Convert a
squid
log file date/time field to a human\-readable format\&. All the log files are read and output as one text on the standard output\&.
+.sp
+If the input log file name is
+\fI\-\fR, the input log file is read from standard input\&.
.RE
.PP
\fB\-\-css\fR
\fB\-\-convert\fR
the dates are also converted to a human\-readable format\&.
.sp
+If the input log file name is
+\fI\-\fR, the input log file is read from standard input\&.
+.sp
Combined with
-\fB\-P\fR, the log is written in several files each containing one day of the original log\&.
+\fB\-P\fR, the log is written in several files each containing one day worth of the original log\&.
.RE
.PP
\fB\-t \fR\fB\fIstring\fR\fR
Convert a <application>squid</application> log file date/time field to a human-readable format.
All the log files are read and output as one text on the standard output.
</para>
+<para>
+If the input log file name is <replaceable>-</replaceable>, the input log file
+is read from standard input.
+</para>
</listitem>
</varlistentry>
the dates are also converted to a human-readable format.
</para>
<para>
-Combined with <option>-P</option>, the log is written in several files each containing one day of the
-original log.
+If the input log file name is <replaceable>-</replaceable>, the input log file
+is read from standard input.
+</para>
+<para>
+Combined with <option>-P</option>, the log is written in several files each
+containing one day worth of the original log.
</para>
</listitem>
</varlistentry>
if(arq[0] == '\0')
arq="/var/log/squid/access.log";
- if((fp_in=MY_FOPEN(arq,"r"))==NULL) {
+ if (arq[0]=='-' && arq[1]=='\0') {
+ fp_in=stdin;
+ } else if((fp_in=MY_FOPEN(arq,"r"))==NULL) {
debuga(_("(splitlog) Cannot open log file %s - %s\n"),arq,strerror(errno));
exit(EXIT_FAILURE);
}
}
longline_destroy(&line);
- if (fclose(fp_in)==EOF) {
+ if (fp_in!=stdin && fclose(fp_in)==EOF) {
debuga(_("Failed to close file %s - %s\n"),arq,strerror(errno));
}
if (autosplit && fp_ou) {