One common class of questions from users is to ask why sarg isn't
producing some kind of report. Considering the number of configuration
parameters, it is not surprising that some users get lost.
To help the users help themselves, the -z command line option has been
enhanced to print messages indicating why sarg don't produce a report.
17 files changed:
SET(sarg_VERSION 2)
SET(sarg_REVISION "3.2-pre2")
SET(sarg_BUILD "")
SET(sarg_VERSION 2)
SET(sarg_REVISION "3.2-pre2")
SET(sarg_BUILD "")
-SET(sarg_BUILDDATE "Sep-14-2011")
+SET(sarg_BUILDDATE "Oct-30-2011")
INCLUDE(AddFileDependencies)
INCLUDE(CheckIncludeFile)
INCLUDE(AddFileDependencies)
INCLUDE(CheckIncludeFile)
if(authfail_count == 0) {
unlink(tmp4);
if(authfail_count == 0) {
unlink(tmp4);
+ if (debugz) debugaz(_("Authentication failures report not produced because it is empty\n"));
debuga(_("Maybe you have a broken record or garbage in your %s file\n"),DansGuardianConf);
exit(EXIT_FAILURE);
}
debuga(_("Maybe you have a broken record or garbage in your %s file\n"),DansGuardianConf);
exit(EXIT_FAILURE);
}
+ if (debug) debuga(_("Using the dansguardian log file \"%s\" found in your configuration file \"%s\"\n"),
+ loglocation,DansGuardianConf);
snprintf(dansguardian_in,sizeof(dansguardian_in),"%s/dansguardian.log",tmp);
if(!dansguardian_count) {
unlink(dansguardian_in);
snprintf(dansguardian_in,sizeof(dansguardian_in),"%s/dansguardian.log",tmp);
if(!dansguardian_count) {
unlink(dansguardian_in);
+ if (debugz) debugaz(_("Dansguardian report not generated because it is empty\n"));
sprintf(denied_in,"%s/denied.log",tmp);
if (!denied_count) {
unlink(denied_in);
sprintf(denied_in,"%s/denied.log",tmp);
if (!denied_count) {
unlink(denied_in);
+ if (debugz) debugaz(_("Denied report not produced because it is empty\n"));
-/*! \fn void debuga(const char *msg,...)
-Write a debug message to stderr. The message is prefixed by "SARG:" to identify its origin.
-
-\param msg The printf like message to format.
-\param ... The arguments to format in the message.
-
-*/
-
-
-
-
-
-/*! \fn void debugaz(const char *head, const char *msg)
-Write a debug message to stderr with the value of a parameter. The message is prefixed by "SARG: (util)".
-
-\param head The name of the parameter.
-\param msg The value of the parameter.
-*/
-
-
-
-
-
/*! \fn char *fixnum(long long int value, int n)
Rewrite a number to make it more readable. The number may be written
with the suffix K, M, G or T depending on its magnitude or the digits
/*! \fn char *fixnum(long long int value, int n)
Rewrite a number to make it more readable. The number may be written
with the suffix K, M, G or T depending on its magnitude or the digits
ouser2[0]='\0';
snprintf(report_in,sizeof(report_in),"%s/download.log",tmp);
ouser2[0]='\0';
snprintf(report_in,sizeof(report_in),"%s/download.log",tmp);
- if(access(report_in, R_OK) != 0)
+ if(access(report_in, R_OK) != 0) {
+ if (debugz) debugaz(_("Downloaded files report not generated as it is empty\n"));
snprintf(report,sizeof(report),"%s/download.html",outdirname);
snprintf(report,sizeof(report),"%s/download.html",outdirname);
const struct userinfostruct *uinfo;
userscan uscan;
const struct userinfostruct *uinfo;
userscan uscan;
- if((ReportType & REPORT_TYPE_USERS_SITES) == 0) return;
-
if (snprintf(tmp2,sizeof(tmp2),"%s/sargtmp.unsort",tmp)>=sizeof(tmp2)) {
debuga(_("File name too long: %s/sargtmp.unsort\n"),tmp);
exit(EXIT_FAILURE);
if (snprintf(tmp2,sizeof(tmp2),"%s/sargtmp.unsort",tmp)>=sizeof(tmp2)) {
debuga(_("File name too long: %s/sargtmp.unsort\n"),tmp);
exit(EXIT_FAILURE);
void output_html_url(FILE *fp_ou,const char *url);
void output_html_link(FILE *fp_ou,const char *url,int maxlen);
void debuga(const char *msg,...) __attribute__((format(printf,1,2)));
void output_html_url(FILE *fp_ou,const char *url);
void output_html_link(FILE *fp_ou,const char *url,int maxlen);
void debuga(const char *msg,...) __attribute__((format(printf,1,2)));
-void debugaz(const char *head, const char *msg);
+void debugaz(const char *msg,...) __attribute__((format(printf,1,2)));
void my_lltoa(unsigned long long int n, char *s, int ssize, int len);
char *get_size(const char *path, const char *file);
void url_module(const char *url, char *w2);
void my_lltoa(unsigned long long int n, char *s, int ssize, int len);
char *get_size(const char *path, const char *file);
void url_module(const char *url, char *w2);
-#define VERSION PACKAGE_VERSION" Sep-14-2011"
+#define VERSION PACKAGE_VERSION" Oct-30-2011"
#define PGM PACKAGE_NAME
#define URL "http://sarg.sourceforge.net"
#define PGM PACKAGE_NAME
#define URL "http://sarg.sourceforge.net"
- debugaz("data",dia);
- debugaz("period",period.text);
+ debugaz(_("date=%s\n"),dia);
+ debugaz(_("period=%s\n"),period.text);
- if(SquidGuardConf[0] == '\0' && NRedirectorLogs == 0)
+ if(SquidGuardConf[0] == '\0' && NRedirectorLogs == 0) {
+ if (debugz) debugaz(_("No redirector logs provided to produce that kind of report\n"));
sprintf(guard_in,"%s/redirector.unsort",tmp);
sprintf(guard_ou,"%s/redirector.log",tmp);
sprintf(guard_in,"%s/redirector.unsort",tmp);
sprintf(guard_ou,"%s/redirector.log",tmp);
sprintf(squidguard_in,"%s/redirector.log",tmp);
if(!redirector_count) {
unlink(squidguard_in);
sprintf(squidguard_in,"%s/redirector.log",tmp);
if(!redirector_count) {
unlink(squidguard_in);
+ if (debugz) debugaz(_("Redirector report not generated because it is empty\n"));
- debugaz("outdirname",outdirname);
+ debugaz(_("outdirname=%s\n"),outdirname);
}
if(UserAgentLog[0] != '\0' && email[0] == '\0') useragent();
}
if(UserAgentLog[0] != '\0' && email[0] == '\0') useragent();
fclose(fp_gen);
if (puinfo && !indexonly) day_totalize(tmp,puinfo);
fclose(fp_gen);
if (puinfo && !indexonly) day_totalize(tmp,puinfo);
- if (!indexonly) tmpsort();
+ if (!indexonly)
+ tmpsort();
+ else if (debugz)
+ debugaz(_("Only the index is generated as requested\n"));
if(email[0] == '\0') {
if (!indexonly) {
if(email[0] == '\0') {
if (!indexonly) {
- if((ReportType & REPORT_TYPE_DOWNLOADS) != 0) download_report();
+ if((ReportType & REPORT_TYPE_DOWNLOADS) != 0)
+ download_report();
+ else if (debugz)
+ debugaz(_("Downloaded files report not requested in report_type\n"));
- if(DansGuardianConf[0] != '\0') {
+ if(DansGuardianConf[0] != '\0')
+ else if (debugz)
+ debugaz(_("Dansguardian report not produced because no dansguardian configuration file was provided\n"));
topuser();
if (!indexonly) {
topuser();
if (!indexonly) {
- if((ReportType & REPORT_TYPE_TOPSITES) != 0) topsites();
-
- if((ReportType & REPORT_TYPE_SITES_USERS) != 0) siteuser();
+ if((ReportType & REPORT_TYPE_TOPSITES) != 0)
+ topsites();
+ else if (debugz)
+ debugaz(_("Top sites report not requested in report_type\n"));
+
+ if((ReportType & REPORT_TYPE_SITES_USERS) != 0)
+ siteuser();
+ else if (debugz)
+ debugaz(_("Sites & users report not requested in report_type\n"));
if ((ReportType & REPORT_TYPE_DENIED) != 0)
gen_denied_report();
if ((ReportType & REPORT_TYPE_DENIED) != 0)
gen_denied_report();
+ else if (debugz)
+ debugaz(_("Denied accesses report not requested in report_type\n"));
if ((ReportType & REPORT_TYPE_AUTH_FAILURES) != 0)
authfail_report();
if ((ReportType & REPORT_TYPE_AUTH_FAILURES) != 0)
authfail_report();
+ else if (debugz)
+ debugaz(_("Authentication failures report not requested in report_type\n"));
if(smartfilter) smartfilter_report();
if(smartfilter) smartfilter_report();
- if(DansGuardianConf[0] != '\0') dansguardian_report();
+ if(DansGuardianConf[0] != '\0')
+ dansguardian_report();
- if((ReportType & REPORT_TYPE_USERS_SITES) != 0) htmlrel();
+ if((ReportType & REPORT_TYPE_USERS_SITES) != 0)
+ htmlrel();
+ else if (debugz)
+ debugaz(_("User's detailed report not requested in report_type\n"));
struct generalitemstruct item;
const struct userinfostruct *uinfo;
struct generalitemstruct item;
const struct userinfostruct *uinfo;
+ if(Privacy) {
+ if (debugz) debugaz(_("Sites and users report not generated because privacy option is on\n"));
nsitesusers = 0;
sprintf(general,"%s/sarg-general",outdirname);
nsitesusers = 0;
sprintf(general,"%s/sarg-general",outdirname);
longline line;
struct generalitemstruct item;
longline line;
struct generalitemstruct item;
+ if(Privacy) {
+ if (debugz) debugaz(_("Top sites report not produced because privacy option is on\n"));
sprintf(general,"%s/sarg-general",outdirname);
sprintf(sites,"%s/sarg-sites",outdirname);
sprintf(general,"%s/sarg-general",outdirname);
sprintf(sites,"%s/sarg-sites",outdirname);
if ((ReportType & REPORT_TYPE_TOPUSERS) == 0) {
fputs("</body>\n</html>\n",fp_top3);
fclose (fp_top3);
if ((ReportType & REPORT_TYPE_TOPUSERS) == 0) {
fputs("</body>\n</html>\n",fp_top3);
fclose (fp_top3);
+ if (debugz) debugaz(_("No top users report because it is not configured in report_type\n"));
+/*!
+Write a debug message to stderr. The message is prefixed by "SARG:" to identify its origin.
+
+\param msg The printf like message to format.
+\param ... The arguments to format in the message.
+*/
void debuga(const char *msg,...)
{
va_list ap;
void debuga(const char *msg,...)
{
va_list ap;
-void debugaz(const char *head, const char *msg)
+/*!
+Write a debug message to stderr. The message is prefixed by "SARG: (info)".
+
+\param msg The printf like message to format.
+\param ... The arguments to format in the message.
+*/
+void debugaz(const char *msg,...)
- fprintf(stderr, "SARG: (util) %s=%s\n",head, msg);
+ va_list ap;
+
+ fputs(_("SARG: (info) "),stderr);
+ va_start(ap,msg);
+ vfprintf(stderr,msg,ap);
+ va_end(ap);