- Change the CSS template file and cleanup of the hardcoded styles (thanks to Maxim Britov).
- 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.
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).
#include "include/conf.h"
#include "include/defs.h"
-void css(FILE *fp_css)
+void css_content(FILE *fp_css)
{
- if(ExternalCSSFile[0] != '\0') {
- fprintf(fp_css,"<link rel=\"stylesheet\" href=\"%s\" type=\"text/css\">\n",ExternalCSSFile);
- return;
- }
-
- fprintf(fp_css,"<style type=\"text/css\">\n");
-
fprintf(fp_css,".logo {font-family:Verdana,Tahoma,Arial;font-size:11px;color:%s;text-align:center;vertical-align:middle;border:none;padding:0px;margin-bottom:5px;}\n",LogoTextColor);
fprintf(fp_css,".logo th {padding:0px;}\n");
fprintf(fp_css,".logo img {vertical-align:middle;padding:0px;border:0px none;}\n");
fprintf(fp_css,".link a:link,a:visited {font-family:%s;font-size:%s;color:#0000FF;text-decoration:none;}\n", FontFace, FontSize);
fprintf(fp_css,"a > img {border:none;}\n");
+}
+void css(FILE *fp_css)
+{
+ if(ExternalCSSFile[0] != '\0') {
+ fprintf(fp_css,"<link rel=\"stylesheet\" href=\"%s\" type=\"text/css\">\n",ExternalCSSFile);
+ return;
+ }
+
+ fprintf(fp_css,"<style type=\"text/css\">\n");
+ css_content(fp_css);
fputs("</style>\n",fp_css);
}
-.body {font-family:Verdana,Tahoma,Arial;color:#000000;background-color:#ffffff;}
-.info {font-family:Verdana,Tahoma,Arial;font-size:9px;}
-.info a:link,a:visited {font-family:Verdana,Tahoma,Arial;color:#0000ff;font-size:9px;text-decoration:none;}
-.title_c {font-family:Verdana,Tahoma,Arial;font-size:11px;color:darkblue;background-color:#ffffff;text-align:center;}
-.title_l {font-family:Verdana,Tahoma,Arial;font-size:11px;color:darkblue;background-color:#ffffff;text-align:left;}
-.title_r {font-family:Verdana,Tahoma,Arial;font-size:11px;color:darkblue;background-color:#ffffff;text-align:right;}
-.header_c {font-family:Verdana,Tahoma,Arial;font-size:9px;color:darkblue;background-color:#dddddd;text-align:center;border-right:1px solid #666666;border-bottom:1px solid #666666;}
-.header_l {font-family:Verdana,Tahoma,Arial;font-size:9px;color:darkblue;background-color:#dddddd;text-align:left;border-right:1px solid #666666;border-bottom:1px solid #666666;}
-.header_r {font-family:Verdana,Tahoma,Arial;font-size:9px;color:darkblue;background-color:#dddddd;text-align:right;border-right:1px solid #666666;border-bottom:1px solid #666666;}
-.text {font-family:Verdana,Tahoma,Arial;color:#000000;font-size:9px;text-align:right;}
-.data {font-family:Verdana,Tahoma,Arial;color:#000000;font-size:9px;background-color:lavender;text-align:right;border-right:1px solid #6a5acd;border-bottom:1px solid #6a5acd;}
-.data a:link,a:visited {font-family:Verdana,Tahoma,Arial;color:#0000ff;font-size:9px;background-color:lavender;text-align:right;text-decoration:none;}
-.data2 {font-family:Verdana,Tahoma,Arial;color:#000000;font-size:9px;background-color:lavender;text-align:left;border-right:1px solid #6a5acd;border-bottom:1px solid #6a5acd;}
-.data2 a:link,a:visited {font-family:Verdana,Tahoma,Arial;color:#0000ff;font-size:9px;text-align:left;background-color:lavender;text-decoration:none;}
-.data3 {font-family:Verdana,Tahoma,Arial;color:#000000;font-size:9px,text-align:center;background-color:lavender;border-right:1px solid #6a5acd;border-bottom:1px solid #6a5acd;}
-.data3 a:link,a:visited {font-family:Verdana,Tahoma,Arial;color:#0000ff;font-size:9px;text-align:center;background-color:lavender;text-decoration:none;}
-.text {font-family:Verdana,Tahoma,Arial;color:#000000;font-size:9px;text-align:right;}
-.link {font-family:Verdana,Tahoma,Arial;font-size:9px;color:#0000ff;}
-.link a:link,a:visited {font-family:Verdana,Tahoma,Arial;font-size:9px;color:#0000ff;text-decoration:none;}
+.logo {font-family:Verdana,Tahoma,Arial;font-size:11px;color:#006699;text-align:center;vertical-align:middle;border:none;padding:0px;margin-bottom:5px;}
+.logo th {padding:0px;}
+.logo img {vertical-align:middle;padding:0px;border:0px none;}
+.body {font-family:Tahoma,Verdana,Arial;font-size:11px;color:#000000;background-color:white;background-image:url();}
+.info {font-family:Tahoma,Verdana,Arial;font-size:10px;text-align:center;margin-top:1em;margin-bottom:1em;}
+.info a:link,a:visited {font-family:Tahoma,Verdana,Arial;color:#0000FF;font-size:10px;text-decoration:none;}
+.title {width:100%;text-align:center;margin-bottom:1em;}
+div.title > table {margin:auto;}
+.title_c {font-family:Tahoma,Verdana,Arial;font-size:11px;color:green;background-color:white;text-align:center;}
+.title_l {font-family:Tahoma,Verdana,Arial;font-size:11px;color:green;background-color:white;text-align:left;}
+.title_r {font-family:Tahoma,Verdana,Arial;font-size:11px;color:green;background-color:white;text-align:right;}
+.index {width:100%;text-align:center;}
+div.index > table {margin:auto;}
+.report {width:100%;text-align:center;}
+div.report > table {margin:auto;}
+.header_l {font-family:Tahoma,Verdana,Arial;font-size:9px;color:darkblue;background-color:blanchedalmond;text-align:left;border-right:1px solid #666666;border-bottom:1px solid #666666;}
+.header_r {font-family:Tahoma,Verdana,Arial;font-size:9px;color:darkblue;background-color:blanchedalmond;text-align:right;border-right:1px solid #666666;border-bottom:1px solid #666666;}
+.header_c {font-family:Tahoma,Verdana,Arial;font-size:9px;color:darkblue;background-color:blanchedalmond;text-align:center;border-right:1px solid #666666;border-bottom:1px solid #666666;}
+.data {font-family:Tahoma,Verdana,Arial;color:#000000;font-size:9px;background-color:lavender;text-align:right;border-right:1px solid #6A5ACD;border-bottom:1px solid #6A5ACD;}
+.data a:link,a:visited {font-family:Tahoma,Verdana,Arial;color:#0000FF;font-size:9px;background-color:lavender;text-align:right;text-decoration:none;}
+.data2 {font-family:Tahoma,Verdana,Arial;color:#000000;font-size:9px;background-color:lavender;text-align:left;border-right:1px solid #6A5ACD;border-bottom:1px solid #6A5ACD;}
+.data2 a:link,a:visited {font-family:Tahoma,Verdana,Arial;color:#0000FF;font-size:9px;text-align:left;background-color:lavender;text-decoration:none;}
+.data3 {font-family:Tahoma,Verdana,Arial;color:#000000;font-size:9px;background-color:lavender;text-align:center;border-right:1px solid #6A5ACD;border-bottom:1px solid #6A5ACD;}
+.data3 a:link,a:visited {font-family:Tahoma,Verdana,Arial;color:#0000FF;font-size:9px;text-align:center;background-color:lavender;text-decoration:none;}
+.text {font-family:Tahoma,Verdana,Arial;color:#000000;font-size:9px;background-color:lavender;text-align:right;}
+.link {font-family:Tahoma,Verdana,Arial;font-size:9px;color:#0000FF;}
+.link a:link,a:visited {font-family:Tahoma,Verdana,Arial;font-size:9px;color:#0000FF;text-decoration:none;}
+a > img {border:none;}
--- /dev/null
+/*!\file css.c
+\brief Write the Content Style Sheet of the HTML reports.
+*/
+
+
+/*! \fn void css_content(FILE *fp_css)
+Write the content of the CSS in the file.
+
+\param fp_css The file to write the CSS to.
+*/
+
+
+
+
+/*! \fn void css(FILE *fp_css)
+Write the CSS in the file either as a link to an external file whose name is in
+::ExternalCSSFile or as an inline text.
+
+\param fp_css The file to write the CSS to.
+*/
void convlog(const char *arq, char *df, int dfrom, int duntil);
// css.c
+void css_content(FILE *fp_css);
void css(FILE *fp_css);
// dansguardian_log.c
struct userfilestruct *first_user_file, *ufile, *ufile1, *prev_ufile;
static int split=0;
static int convert=0;
+ static int output_css=0;
int option_index;
static struct option long_options[]=
{
{"convert",no_argument,&convert,1},
+ {"css",no_argument,&output_css,1},
{"split",no_argument,&split,1},
{0,0,0,0}
};
NAccessLog++;
}
+ if(output_css) {
+ css_content(stdout);
+ exit(EXIT_SUCCESS);
+ }
if(split) {
splitlog(AccessLog[0], df, dfrom, duntil, convert);
exit(EXIT_SUCCESS);
"Project-Id-Version: sarg 2.3-pre3\n"
"Report-Msgid-Bugs-To: fmarchal@users.sourceforge.net\n"
"POT-Creation-Date: 2010-05-27 14:44+0200\n"
-"PO-Revision-Date: 2010-05-24 17:40+0200\n"
+"PO-Revision-Date: 2010-05-27 20:01+0200\n"
"Last-Translator: Frédéric Marchal <fmarchal@perso.be>\n"
"Language-Team: French <traduc@traduc.org>\n"
"MIME-Version: 1.0\n"
msgstr "Erreur à la fermeture du fichier %s - %s\n"
#: convlog.c:46
-#, fuzzy, c-format
+#, c-format
msgid "(convlog) Cannot open log file %s - %s\n"
-msgstr "(log) Impossible d'ouvrir le fichier: %s - %s\n"
+msgstr "(convlog) Impossible d'ouvrir le journal %s - %s\n"
#: convlog.c:51 splitlog.c:51
-#, fuzzy, c-format
+#, c-format
msgid "Not enough memory to read the log file %s\n"
-msgstr "Pas assez de mémoire pour lire le journal\n"
+msgstr "Pas assez de mémoire pour lire le journal %s\n"
#: convlog.c:58
#, c-format
#: getconf.c:319
#, c-format
-msgid ""
-"Value \"%s\" conflicts with other selected values for parameter \"%s\"\n"
+msgid "Value \"%s\" conflicts with other selected values for parameter \"%s\"\n"
msgstr ""
"La valeur «%s» entre en conflit avec les autres valeurs sélectionnées pour le "
"paramètre «%s»\n"
#: getconf.c:386
#, c-format
-msgid ""
-"Maybe you have a broken record or garbage in \"date_format\" parameter\n"
+msgid "Maybe you have a broken record or garbage in \"date_format\" parameter\n"
msgstr ""
"Vous avez probablement un enregistrement erroné ou inattendu dans le "
"paramètre «date_format»\n"
msgstr "Utilisateur: %s"
#: grepday.c:617 grepday.c:719
-#, fuzzy, c-format
+#, c-format
msgid "user name too long for %s/%s/%s\n"
-msgstr "Le nom d'utilisateur est trop long pour %s/%s.day\n"
+msgstr "Le nom d'utilisateur est trop long pour %s/%s/%s\n"
#: grepday.c:621 grepday.c:680
#, c-format
msgstr "Temps écoulé incorrect dans le fichier %s\n"
#: grepday.c:723
-#, fuzzy, c-format
+#, c-format
msgid "(grepday) Cannot open output file %s\n"
-msgstr "(grepday) Impossible d'ouvrir le journal %s\n"
+msgstr "(grepday) Impossible d'ouvrir le fichier de sortie %s\n"
#: grepday.c:726
-#, fuzzy
msgid "Graph report"
-msgstr "Rapport journalier"
+msgstr "Rapport graphique"
#: grepday.c:733 grepday.c:746 index.c:252
msgid "DAYS"
#: log.c:1687
#, c-format
msgid "Failed to move till the end of the users file %s: %s\n"
-msgstr ""
-"La fin du fichier des utilisateurs (%s) ne peut pas être atteinte: %s\n"
+msgstr "La fin du fichier des utilisateurs (%s) ne peut pas être atteinte: %s\n"
#: log.c:1697
#, c-format
#: log.c:1712
#, c-format
msgid "You have an invalid user in your %s file\n"
-msgstr ""
-"Vous avez probablement un utilisateur incorrect dans votre fichier %s\n"
+msgstr "Vous avez probablement un utilisateur incorrect dans votre fichier %s\n"
#: longline.c:113 longline.c:126
#, c-format
msgstr "le nom d'utilisateur est trop long pour %s/%s.unsort\n"
#: splitlog.c:46
-#, fuzzy, c-format
+#, c-format
msgid "(splitlog) Cannot open log file %s - %s\n"
-msgstr "(splitlog) Impossible d'ouvrir le fichier %s\n"
+msgstr "(splitlog) Impossible d'ouvrir le fichier %s - %s\n"
#: splitlog.c:58
-#, fuzzy, c-format
+#, c-format
msgid "Invalid date found in file %s\n"
msgstr "Mauvaise date dans le fichier %s\n"
#: usage.c:37
msgid " -e Email address to send reports (stdout for console)"
-msgstr ""
-" -e Adresse e-mail où envoyer les rapports (stdout pour la console)"
+msgstr " -e Adresse e-mail où envoyer les rapports (stdout pour la console)"
#: usage.c:38
#, c-format
#: util.c:294
#, c-format
msgid "Invalid path (%s). Please, use absolute paths only.\n"
-msgstr ""
-"Chemin erroné (%s). Veuillez utiliser des chemins absolus uniquement.\n"
+msgstr "Chemin erroné (%s). Veuillez utiliser des chemins absolus uniquement.\n"
#: util.c:295 util.c:310 util.c:322
#, c-format
.B sarg
.RI [ options ]
.SH DESCRIPTION
-\fBsarg\fP is a logfile parser and anylizer for the \fBSquid Web Proxy Cache\fP,
+\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
.IR "filename"
as the exclude files to select records that are not counted.
.TP
+.B \-\-convert
+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.
+.TP
+.B \-\-css
+Output, on the standard output, the internal css inlined in the reports by sarg. You can redirect the output to a file of your
+choice and edit it. Then you can override the internal css with
+.B external_css_file
+in sarg.conf.
+.TP
.B \-d date
Uses
.I date
.IR "string
[eg. www.debian.org]
.TP
+.B \-\-split
+Split the squid log file and output it as text on the standard output omitting the dates outside of the range specified by the \fB-d\fP parameter.
+If it is combined with
+.B \-\-convert
+the dates are also converted to a human-readable format.
+.TP
.B \-t string
Limits records counted in statistics based on time-of-day. Format for
\fIstring\fP is \fBHH\fP or \fBHH:MM\fP or \fBHH:MM:SS\fP.
.TP
.B \-z
Writes messages on processes to \fBSTDOUT\fP
-.TP
-.B \-convert
-Convert the logfile's date/time field to human-readable.
-.TP
-.B \-split
-Split the log file by date in \fB-d\fP parameter.
.SH FILES
.BR /usr/local/sarg/sarg.conf
.br
#block_it none
# TAG: external_css_file path
-# This tag allow internal sarg css override by providing the name of
-# the css file to link into each HTML page.
+# Provide the path to an external css file to link into the HTML reports instead of
+# the inline css written by sarg when this option is not set.
#
# In versions prior to 2.3, this used to be an absolute file name to
-# a file to include verbatim in each HTML but as it takes a lot of
-# spaces, version 2.3 switched to a link to an external css file.
-# Therefore, it must be the HTTP server path on which a client browser
-# may find the css file.
+# a file to include verbatim in each HTML page but, as it takes a lot of
+# space, version 2.3 switched to a link to an external css file.
+# Therefore, this option must contain the HTTP server path on which a client
+# browser may find the css file.
#
# Sarg use theses style classes:
# .logo logo class
# .data3 table text class, align:center
# .link link class
#
-# There is a sample in /usr/local/sarg/etc/css.tpl
+# Sarg can be instructed to output the internal css it inline
+# into the reports with this command:
+#
+# sarg --css
+#
+# You can redirect the output to a file of your choice and edit
+# it to your liking.
#
#external_css_file none