]> git.ipfire.org Git - thirdparty/sarg.git/blobdiff - log.c
Add support to decompress xz files
[thirdparty/sarg.git] / log.c
diff --git a/log.c b/log.c
index 30561a0a8c148099fb285bc19727a19f74995bea..0bda1f36b766295b7be484312d6e05fb24bfa858 100644 (file)
--- a/log.c
+++ b/log.c
@@ -249,6 +249,7 @@ int main(int argc,char *argv[])
        redirector_count=0;
        useragent_count=0;
        DeniedReportLimit=10;
+       SiteUsersReportLimit=0;
        AuthfailReportLimit=10;
        DansGuardianReportLimit=10;
        SquidGuardReportLimit=10;
@@ -456,7 +457,7 @@ int main(int argc,char *argv[])
        }
 
        if(access(ConfigFile, R_OK) == 0)
-               getconf();
+               getconf(ConfigFile);
 
        if(userip) UserIp=true;
 
@@ -531,8 +532,11 @@ int main(int argc,char *argv[])
        if(ReportType == 0) {
                ReportType=REPORT_TYPE_TOPUSERS | REPORT_TYPE_TOPSITES | REPORT_TYPE_USERS_SITES |
                           REPORT_TYPE_SITES_USERS | REPORT_TYPE_DATE_TIME | REPORT_TYPE_DENIED |
-                          REPORT_TYPE_AUTH_FAILURES | REPORT_TYPE_SITE_USER_TIME_DATE | REPORT_TYPE_DOWNLOADS;
+                                  REPORT_TYPE_AUTH_FAILURES | REPORT_TYPE_SITE_USER_TIME_DATE |
+                                  REPORT_TYPE_DOWNLOADS | REPORT_TYPE_USERAGENT;
        }
+       if (!FileList_IsEmpty(UserAgentLog))
+               ReportType|=REPORT_TYPE_USERAGENT;
 
        if(access(ExcludeUsers, R_OK) == 0) {
                getuexclude(ExcludeUsers,debug);
@@ -666,8 +670,6 @@ int main(int argc,char *argv[])
        }
 #endif
 
-       init_usertab(UserTabFile);
-
        read_start_time=time(NULL);
        LogStatus=ReadLogFile(&ReadFilter);
        read_end_time=time(NULL);
@@ -682,11 +684,12 @@ int main(int argc,char *argv[])
                char date0[30], date1[30];
                struct tm Start,End;
 
-               GetLogPeriod(&Start,&End);
-               strftime(date0,sizeof(date0),"%x",&Start);
-               strftime(date1,sizeof(date1),"%x",&End);
-               // TRANSLATORS: The %s are the start and end dates in locale format.
-               debuga(__FILE__,__LINE__,_("Period covered by log files: %s-%s\n"),date0,date1);
+               if (GetLogPeriod(&Start,&End)) {
+                       strftime(date0,sizeof(date0),"%x",&Start);
+                       strftime(date1,sizeof(date1),"%x",&End);
+                       // TRANSLATORS: The %s are the start and end dates in locale format.
+                       debuga(__FILE__,__LINE__,_("Period covered by log files: %s-%s\n"),date0,date1);
+               }
        }
 
        if (!LogStatus){