sarg  2.4.0
About: SARG ia a Squid Analysis Report Generator.
  Fossies Dox: sarg-2.4.0.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

log.c
Go to the documentation of this file.
1 /*
2  * SARG Squid Analysis Report Generator http://sarg.sourceforge.net
3  * 1998, 2015
4  *
5  * SARG donations:
6  * please look at http://sarg.sourceforge.net/donations.php
7  * Support:
8  * http://sourceforge.net/projects/sarg/forums/forum/363374
9  * ---------------------------------------------------------------------
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
24  *
25  */
26 
27 #include "include/conf.h"
28 #include "include/defs.h"
29 #include "include/readlog.h"
30 #include "include/filelist.h"
31 
32 #ifdef HAVE_GETOPT_H
33 #include <getopt.h>
34 #endif
35 
38 
40 /*@null@*/char *userfile=NULL;
41 
45 char *CurrentLocale=NULL;
48 
50 
51 static void getusers(const char *pwdfile, int debug);
52 static void CleanTemporaryDir();
53 
54 int main(int argc,char *argv[])
55 {
56  extern int optind;
57  extern int optopt;
58  extern char *optarg;
59 
60  char hm_str[15];
61  char hexclude[MAXLEN];
62  char splitprefix[MAXLEN];
63  int ch;
64  int errflg=0;
65  bool dns=false;
66  int iarq=0;
67  int lastlog=-1;
68  int LogStatus;
69  bool realt;
70  bool userip;
71  time_t start_time;
72  time_t end_time;
73  time_t read_start_time;
74  time_t read_end_time;
75  time_t process_start_time;
76  time_t process_end_time;
77  double read_elapsed;
78  double process_elapsed;
79  FileListIterator FIter;
80  static int split=0;
81  static int convert=0;
82  static int output_css=0;
83  static int show_statis=0;
84  static int show_version=0;
85  int option_index;
86  static struct option long_options[]=
87  {
88  {"convert",no_argument,&convert,1},
89  {"css",no_argument,&output_css,1},
90  {"help",no_argument,NULL,'h'},
91  {"lastlog",required_argument,NULL,2},
92  {"keeplogs",no_argument,NULL,3},
93  {"split",no_argument,&split,1},
94  {"splitprefix",required_argument,NULL,'P'},
95  {"statistics",no_argument,&show_statis,1},
96  {"version",no_argument,&show_version,'V'},
97  {0,0,0,0}
98  };
99 
100  start_time=time(NULL);
101 
102 #ifdef HAVE_LOCALE_H
103  setlocale(LC_TIME,"");
104 #endif
105 
106 #if defined(ENABLE_NLS) && defined(HAVE_LOCALE_H)
107  CurrentLocale=setlocale (LC_ALL, "");
108  if (!CurrentLocale) {
109  fprintf(stderr,"SARG: Cannot set the locale LC_ALL to the environment variable\n");
110  exit(EXIT_FAILURE);
111  }
112  if (!bindtextdomain (PACKAGE_NAME, LOCALEDIR)) {
113  fprintf(stderr,"SARG: Cannot bind to text domain %s in directory %s (%s)\n",PACKAGE_NAME,LOCALEDIR,strerror(errno));
114  exit(EXIT_FAILURE);
115  }
116  if (!textdomain (PACKAGE_NAME)) {
117  fprintf(stderr,"SARG: Cannot set gettext domain for %s PACKAGE_NAME (%s)\n",PACKAGE_NAME,strerror(errno));
118  exit(EXIT_FAILURE);
119  }
120 #endif //ENABLE_NLS
121 
122  BgImage[0]='\0';
123  LogoImage[0]='\0';
124  LogoText[0]='\0';
125  PasswdFile[0]='\0';
126  OutputEmail[0]='\0';
127  ExcludeHosts[0]='\0';
128  ExcludeUsers[0]='\0';
129  ConfigFile[0]='\0';
130  code[0]='\0';
131  LastLog=0;
132  ReportType=0UL;
133  UserTabFile[0]='\0';
134  BlockIt[0]='\0';
135  ExternalCSSFile[0]='\0';
136  RedirectorLogFormat[0]='\0';
137  NRedirectorLogs=0;
138 
139  snprintf(ExcludeCodes,sizeof(ExcludeCodes),"%s/exclude_codes",SYSCONFDIR);
140  strcpy(GraphDaysBytesBarColor,"orange");
141  strcpy(BgColor,"#ffffff");
142  strcpy(TxColor,"#000000");
143  strcpy(TxBgColor,"lavender");
144  strcpy(TiColor,"darkblue");
145  strcpy(Width,"80");
146  strcpy(Height,"45");
147  strcpy(LogoTextColor,"#000000");
148  strcpy(HeaderColor,"darkblue");
149  strcpy(HeaderBgColor,"#dddddd");
150  strcpy(LogoTextColor,"#006699");
151  strcpy(FontSize,"9px");
152  strcpy(TempDir,"/tmp");
153  TempDirPath[0] = '\0';
154  strcpy(OutputDir,"/var/www/html/squid-reports");
155  AnonymousOutputFiles=false;
156  Ip2Name=false;
157  DateFormat='u';
158  OverwriteReport=false;
159  RemoveTempFiles=true;
163  UseComma=0;
164  strcpy(MailUtility,"mailx");
165  TopSitesNum=100;
166  TopUsersNum=0;
167  UserIp=0;
171  LongUrl=0;
172  strcpy(FontFace,"Verdana,Tahoma,Arial");
174  strcpy(CharSet,"ISO-8859-1");
175  Privacy=0;
176  strcpy(PrivacyString,"***.***.***.***");
177  strcpy(PrivacyStringColor,"blue");
178  SuccessfulMsg=true;
186  strcpy(DataFileDelimiter,";");
189  ShowReadStatistics=true;
190  ShowReadPercent=false;
191  strcpy(IndexSortOrder,"D");
192  ShowSargInfo=true;
193  ShowSargLogo=true;
194  ParsedOutputLog[0]='\0';
195  strcpy(ParsedOutputLogCompress,"/bin/gzip -f");
197  strcpy(HeaderFontSize,"9px");
198  strcpy(TitleFontSize,"11px");
199  strcpy(AuthUserTemplateFile,"sarg_htaccess");
200  set_download_suffix("7z,ace,arj,avi,bat,bin,bz2,bzip,cab,com,cpio,dll,doc,dot,exe,gz,iso,lha,lzh,mdb,mov,mp3,mpeg,mpg,mso,nrg,ogg,ppt,rar,rtf,shs,src,sys,tar,tgz,vcd,vob,wma,wmv,zip");
201  Graphs=true;
202 #if defined(FONTDIR)
203  strcpy(GraphFont,FONTDIR"/DejaVuSans.ttf");
204 #else
205  GraphFont[0]='\0';
206 #endif
207  strcpy(Ulimit,"20000");
211  strcpy(RealtimeTypes,"GET,PUT,CONNECT,POST");
216  strcpy(MaxElapsed,"28800000");
219  strcpy(LDAPHost,"127.0.0.1");
220  LDAPPort=389;
222  LDAPBindDN[0]='\0';
223  LDAPBindPW[0]='\0';
224  LDAPBaseSearch[0]='\0';
225  strcpy(LDAPFilterSearch, "(uid=%s)");
226  strcpy(LDAPTargetAttr, "cn");
227  LDAPNativeCharset[0]='\0';
228  SortTableJs[0]='\0';
229 
230  tmp[0]='\0';
231  us[0]='\0';
232  ReadFilter.DateRange[0]='\0';
233  df='\0';
234  hexclude[0]='\0';
235  addr[0]='\0';
237  ReadFilter.EndTime=-1;
238  site[0]='\0';
239  outdir[0]='\0';
240  splitprefix[0]='\0';
241  email[0]='\0';
242  UserInvalidChar[0]='\0';
243  DataFile[0]='\0';
244  SquidGuardConf[0]='\0';
245  DansGuardianConf[0]='\0';
246  hm_str[0]='\0';
247  HostAliasFile[0]='\0';
248  UserAliasFile[0]='\0';
249 
252  useragent_count=0;
259  UserReportLimit=0;
260  debug=0;
261  debugz=0;
262  iprel=false;
263  userip=false;
264  realt=false;
267  cost=0.01;
268  nocost=50000000;
269  squid24=false;
272  KeepTempLog=false;
275  lines_read=0UL;
276  records_kept=0UL;
277  nusers=0UL;
278 
279  memset(IncludeUsers,0,sizeof(IncludeUsers));
280  memset(ExcludeString,0,sizeof(ExcludeString));
281  memset(&period,0,sizeof(period));
282 
285 
286  strcpy(Title,_("Squid User Access Report"));
287 
288  while((ch = getopt_long(argc, argv, "a:b:c:d:e:f:g:hikl:L:no:P:prs:t:u:Vw:xyz",long_options,&option_index)) != -1){
289  switch(ch)
290  {
291  case 0:
292  break;
293  case 2:
294  lastlog=atoi(optarg);
295  break;
296  case 3:
297  lastlog=0;
298  break;
299  case 'a':
300  safe_strcpy(addr,optarg,sizeof(addr));
301  break;
302  case 'b': //unused option
304  if (!UserAgentLog)
306  if (!FileList_AddFile(UserAgentLog,optarg)) {
307  debuga(__FILE__,__LINE__,_("Not enough memory to store a user agent file name\n"));
308  exit(EXIT_FAILURE);
309  }
310  break;
311  case 'c':
312  safe_strcpy(hexclude,optarg,sizeof(hexclude));
313  break;
314  case 'd':
317  break;
318  case 'e':
319  safe_strcpy(email,optarg,sizeof(email));
320  break;
321  case 'f':
322  safe_strcpy(ConfigFile,optarg,sizeof(ConfigFile));
323  break;
324  case 'g':
325  df=*optarg;
326  break;
327  case 'h':
328  usage(argv[0]);
329  exit(EXIT_SUCCESS);
330  case 'i':
331  iprel=true;
332  break;
333  case 'k':
334  KeepTempLog=true;
335  break;
336  case 'l':
337  if (!AccessLog)
339  if (!FileList_AddFile(AccessLog,optarg)) {
340  debuga(__FILE__,__LINE__,_("Not enough memory to store the input log file names\n"));
341  exit(EXIT_FAILURE);
342  }
344  break;
345  case 'L':
347  debuga(__FILE__,__LINE__,_("Too many redirector logs passed on command line with option -L.\n"));
348  exit(EXIT_FAILURE);
349  }
350  if (strlen(optarg)>=MAX_REDIRECTOR_FILELEN) {
351  debuga(__FILE__,__LINE__,_("Redirector log file name too long passed on command line with opton -L: %s\n"),optarg);
352  exit(EXIT_FAILURE);
353  }
354  strcpy(RedirectorLogs[NRedirectorLogs],optarg);
355  NRedirectorLogs++;
357  break;
358  case 'n':
359  dns=true;
360  break;
361  case 'o':
362  safe_strcpy(outdir,optarg,sizeof(outdir));
363  break;
364  case 'p':
365  userip=true;
366  break;
367  case 'P':
368  safe_strcpy(splitprefix,optarg,sizeof(splitprefix));
369  break;
370  case 'r':
371  realt=true;
372  break;
373  case 's':
374  safe_strcpy(site,optarg,sizeof(site));
375  break;
376  case 't':
377  {
378  int h1,m1,h2,m2;
379 
380  if (strstr(optarg,"-") == 0) {
381  if (sscanf(optarg,"%d:%d",&h1,&m1)!=2) {
382  debuga(__FILE__,__LINE__,_("Time period passed on the command line with option -t must be HH:MM\n"));
383  exit(EXIT_FAILURE);
384  }
385  ReadFilter.StartTime=h1*100+m1;
387  snprintf(hm_str,sizeof(hm_str),"%02d:%02d",h1,m1);
388  } else {
389  if (sscanf(optarg,"%d:%d-%d:%d",&h1,&m1,&h2,&m2)!=4) {
390  debuga(__FILE__,__LINE__,_("Time range passed on the command line with option -t must be HH:MM-HH:MM\n"));
391  exit(EXIT_FAILURE);
392  }
393  ReadFilter.StartTime=h1*100+m1;
394  ReadFilter.EndTime=h2*100+m2;
395  snprintf(hm_str,sizeof(hm_str),"%02d:%02d-%02d:%02d",h1,m1,h2,m2);
396  }
397  break;
398  }
399  case 'u':
400  safe_strcpy(us,optarg,sizeof(us));
401  break;
402  case 'V':
403  show_version=1;
404  break;
405  case 'w':
406  safe_strcpy(tmp,optarg,sizeof(tmp));
407  break;
408  case 'x':
409  debug++;
410  break;
411  case 'y': //unused option
412  langcode++;
413  break;
414  case 'z':
415  debugz++;
416  break;
417  case ':':
418  debuga(__FILE__,__LINE__,_("Option -%c requires an argument\n"),optopt);
419  exit(EXIT_FAILURE);
420  case '?':
421  usage(argv[0]);
422  exit(EXIT_FAILURE);
423  default:
424  abort();
425  }
426  }
427 
428  if (errflg>0) {
429  usage(argv[0]);
430  exit(2);
431  }
432  if (show_version) {
433  version();
434  }
435 
436  if (output_css) {
437  css_content(stdout);
438  exit(EXIT_SUCCESS);
439  }
440 
441  if (optind<argc) {
442  if (!AccessLog)
444  for (iarq=optind ; iarq<argc ; iarq++) {
445  if (!FileList_AddFile(AccessLog,argv[iarq])) {
446  debuga(__FILE__,__LINE__,_("Not enough memory to store the input log file names\n"));
447  exit(EXIT_FAILURE);
448  }
450  }
451  }
452 
453  if (debug) debuga(__FILE__,__LINE__,_("Init\n"));
454 
455  if (ConfigFile[0] == '\0') snprintf(ConfigFile,sizeof(ConfigFile),"%s/sarg.conf",SYSCONFDIR);
456  if (access(ConfigFile, R_OK) != 0) {
457  debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),ConfigFile,strerror(errno));
458  exit(EXIT_FAILURE);
459  }
460 
461  if (access(ConfigFile, R_OK) == 0)
463 
464  if (userip) UserIp=true;
465 
466  if (dns) ip2name_forcedns();
467 
468  if (lastlog>=0) LastLog=lastlog;
469 
470  if (outdir[0] == '\0') strcpy(outdir,OutputDir);
471  if (outdir[0] != '\0') strcat(outdir,"/");
472 
473  if (IndexTree == INDEX_TREE_FILE)
474  strcpy(ImageFile,"../images");
475  else
476  strcpy(ImageFile,"../../../images");
477 
478  dataonly=(DataFile[0] != '\0');
479 
480  if (df=='\0') df=DateFormat;
481  if (df=='\0') df='u';
482  if (df=='w')
484 
485  if (AccessLog==NULL) {
487  if (!FileList_AddFile(AccessLog,"/var/log/squid/access.log")) {
488  debuga(__FILE__,__LINE__,_("Not enough memory to store the input log file names\n"));
489  exit(EXIT_FAILURE);
490  }
491  }
492 
493  if (realt) {
494  realtime();
495  exit(EXIT_SUCCESS);
496  }
497  if (split) {
498  const char *file;
499 
501  while ((file=FileListIter_Next(FIter))!=NULL)
502  splitlog(file, df, &ReadFilter, convert, splitprefix);
503  FileListIter_Close(FIter);
504  exit(EXIT_SUCCESS);
505  }
506  if (convert) {
507  const char *file;
508 
510  while ((file=FileListIter_Next(FIter))!=NULL)
511  convlog(file, df, &ReadFilter);
512  FileListIter_Close(FIter);
513  exit(EXIT_SUCCESS);
514  }
515 
517 
518  if (access(PasswdFile, R_OK) == 0) {
520  ReadFilter.SysUsers=true;
521  } else {
522  ReadFilter.SysUsers=false;
523  }
524 
525  if (hexclude[0] == '\0')
526  strcpy(hexclude,ExcludeHosts);
527  if (hexclude[0] != '\0') {
528  gethexclude(hexclude,debug);
529  ReadFilter.HostFilter=true;
530  } else {
531  ReadFilter.HostFilter=false;
532  }
533 
534  if (ReportType == 0) {
539  }
542 
543  if (access(ExcludeUsers, R_OK) == 0) {
545  ReadFilter.UserFilter=true;
546  } else {
547  ReadFilter.UserFilter=false;
548  }
549  if (HostAliasFile[0] != '\0')
551  if (UserAliasFile[0] != '\0')
553 
554  indexonly=false;
555  if (ReadFilter.UserFilter) {
556  if (is_indexonly())
557  indexonly=true;
558  }
559  if (strcmp(ExcludeUsers,"indexonly") == 0) indexonly=true;
560  if (Index == INDEX_ONLY) indexonly=true;
561 
562  if (MaxElapsed[0] != '\0')
564  else
566 
567  if (tmp[0] == '\0') strcpy(tmp,TempDir);
568  else strcpy(TempDir,tmp);
569  /*
570  For historical reasons, the temporary directory used to be subdirectory "sarg" of the path
571  provided by the user. The full temporary directory was the predictable name /tmp/sarg. It is unsafe
572  to use a predictable name in the world writable /tmp as malicious users might use that knowledge
573  to lure sarg into some kind of nasty activity it was not designed for.
574  The default is now to use a random name safely created by the system but it is still possible to
575  use a known fixed path set with a parameter in sarg.conf.
576  */
577  if (TempDirPath[0]) {
578  append_to_path(tmp, sizeof(tmp), TempDirPath);
579  } else {
580  append_to_path(tmp, sizeof(tmp), "sargXXXXXX");
581  if (mkdtemp(tmp) == NULL) {
582  debuga(__FILE__,__LINE__,_("Failed to get a unique temporary directory name based on template \"%s\": %s\n"), tmp, strerror(errno));
583  exit(EXIT_FAILURE);
584  }
585  }
586 
587  if (tmp[0]!='\0' && strncmp(outdir,tmp,strlen(tmp))==0) {
588  debuga(__FILE__,__LINE__,_("The output directory \"%s\" must be outside of the temporary directory \"%s\"\n"),outdir,tmp);
589  exit(EXIT_FAILURE);
590  }
591  atexit(CleanTemporaryDir);
592 
593  if (email[0] == '\0' && OutputEmail[0] != '\0') strcpy(email,OutputEmail);
594 
595  if (email[0] != '\0') {
596  my_mkdir(tmp);
597  strcpy(outdir,tmp);
598  strcat(outdir,"/");
599  }
600 
601  makeTmpDir(tmp);
602 
603  if (debug) {
604  const char *file;
605 
606  debuga(__FILE__,__LINE__,_("Parameters:\n"));
607  debuga(__FILE__,__LINE__,_(" Hostname or IP address (-a) = %s\n"),addr);
609  while ((file=FileListIter_NextWithMask(FIter))!=NULL)
610  debuga(__FILE__,__LINE__,_(" Useragent log (-b) = %s\n"),file);
611  FileListIter_Close(FIter);
612  debuga(__FILE__,__LINE__,_(" Exclude file (-c) = %s\n"),hexclude);
613  debuga(__FILE__,__LINE__,_(" Date from-until (-d) = %s\n"),ReadFilter.DateRange);
614  debuga(__FILE__,__LINE__,_(" Email address to send reports (-e) = %s\n"),email);
615  debuga(__FILE__,__LINE__,_(" Config file (-f) = %s\n"),ConfigFile);
616  if (df=='e')
617  debuga(__FILE__,__LINE__,_(" Date format (-g) = Europe (dd/mm/yyyy)\n"));
618  else if (df=='u')
619  debuga(__FILE__,__LINE__,_(" Date format (-g) = USA (mm/dd/yyyy)\n"));
620  else if (df=='w')
621  debuga(__FILE__,__LINE__,_(" Date format (-g) = Sites & Users (yyyy/ww)\n"));
622  debuga(__FILE__,__LINE__,_(" IP report (-i) = %s\n"),(iprel) ? _("Yes") : _("No"));
623  debuga(__FILE__,__LINE__,_(" Keep temporary files (-k) = %s\n"),(KeepTempLog) ? _("Yes") : _("No"));
625  while ((file=FileListIter_NextWithMask(FIter))!=NULL)
626  debuga(__FILE__,__LINE__,_(" Input log (-l) = %s\n"),file);
627  FileListIter_Close(FIter);
628  for (iarq=0 ; iarq<NRedirectorLogs ; iarq++)
629  debuga(__FILE__,__LINE__,_(" Redirector log (-L) = %s\n"),RedirectorLogs[iarq]);
630  debuga(__FILE__,__LINE__,_(" Resolve IP Address (-n) = %s\n"),(Ip2Name) ? _("Yes") : _("No"));
631  debuga(__FILE__,__LINE__,_(" Output dir (-o) = %s\n"),outdir);
632  debuga(__FILE__,__LINE__,_("Use Ip Address instead of userid (-p) = %s\n"),(UserIp) ? _("Yes") : _("No"));
633  debuga(__FILE__,__LINE__,_(" Accessed site (-s) = %s\n"),site);
634  debuga(__FILE__,__LINE__,_(" Time (-t) = %s\n"),hm_str);
635  debuga(__FILE__,__LINE__,_(" User (-u) = %s\n"),us);
636  debuga(__FILE__,__LINE__,_(" Temporary dir (-w) = %s\n"),tmp);
637  debuga(__FILE__,__LINE__,_(" Debug messages (-x) = %s\n"),(debug) ? _("Yes") : _("No"));
638  debuga(__FILE__,__LINE__,_(" Process messages (-z) = %d\n"),debugz);
639  debuga(__FILE__,__LINE__,_(" Previous reports to keep (--lastlog) = %d\n"),LastLog);
640  debuga(__FILE__,__LINE__,"\n");
641  }
642 
643  if (debug)
644  debuga(__FILE__,__LINE__,_("sarg version: %s\n"),VERSION);
645 
646 #ifdef ENABLE_DOUBLE_CHECK_DATA
647  debuga(__FILE__,__LINE__,_("Sarg compiled to report warnings if the output is inconsistent\n"));
648 #endif
649 
650 #ifdef HAVE_RLIM_T
651  if (Ulimit[0] != '\0') {
652  struct rlimit rl;
653  long l1, l2;
654  int rc=0;
655 
656 #if defined(RLIMIT_NOFILE)
657  getrlimit (RLIMIT_NOFILE, &rl);
658 #elif defined(RLIMIT_OFILE)
659  getrlimit (RLIMIT_OFILE, &rl);
660 #else
661 #warning "No rlimit resource for the number of open files"
662 #endif
663  l1 = rl.rlim_cur;
664  l2 = rl.rlim_max;
665 
666  rl.rlim_cur = atol(Ulimit);
667  rl.rlim_max = atol(Ulimit);
668 #if defined(RLIMIT_NOFILE)
669  rc=setrlimit (RLIMIT_NOFILE, &rl);
670 #elif defined(RLIMIT_OFILE)
671  rc=setrlimit (RLIMIT_OFILE, &rl);
672 #else
673 #warning "No rlimit resource for the number of open files"
674 #endif
675  if (rc == -1) {
676  debuga(_("setrlimit error: %s\n"),strerror(errno));
677  }
678 
679  if (debug)
680  debuga("Maximum file descriptor: cur=%ld max=%ld, changed to cur="RLIM_STRING" max="RLIM_STRING"\n",l1,l2,rl.rlim_cur,rl.rlim_max);
681  }
682 #endif
683 
684  read_start_time=time(NULL);
685  LogStatus=ReadLogFile(&ReadFilter);
686  read_end_time=time(NULL);
687  read_elapsed=(double)read_end_time-(double)read_start_time;
688 
690  free_download();
692  free_exclude();
693 
694  if (debug) {
695  char date0[30], date1[30];
696  struct tm Start,End;
697 
698  if (GetLogPeriod(&Start,&End)) {
699  strftime(date0,sizeof(date0),"%x",&Start);
700  strftime(date1,sizeof(date1),"%x",&End);
701  // TRANSLATORS: The %s are the start and end dates in locale format.
702  debuga(__FILE__,__LINE__,_("Period covered by log files: %s-%s\n"),date0,date1);
703  }
704  }
705 
706  if (!LogStatus){
707  debuga(__FILE__,__LINE__,_("No records found\n"));
708  debuga(__FILE__,__LINE__,_("End\n"));
709  userinfo_free();
710  if (userfile) free(userfile);
711  close_usertab();
712  exit(EXIT_SUCCESS);
713  }
714 
715  if (debug) {
716  char date0[30], date1[30];
717 
718  strftime(date0,sizeof(date0),"%x",&period.start);
719  strftime(date1,sizeof(date1),"%x",&period.end);
720  // TRANSLATORS: The %s are the start and end dates in locale format.
721  debuga(__FILE__,__LINE__,_("Period extracted from log files: %s-%s\n"),date0,date1);
722  }
723  if (ReadFilter.DateRange[0] != '\0') {
725  }
726  if (getperiod_buildtext(&period)<0) {
727  debuga(__FILE__,__LINE__,_("Failed to build the string representation of the date range\n"));
728  exit(EXIT_FAILURE);
729  }
730 
731  process_start_time=time(NULL);
732  if (DataFile[0] != '\0')
733  data_file(tmp);
734  else
736  process_end_time=time(NULL);
737  process_elapsed=(double)process_end_time-(double)process_start_time;
738 
739  denied_cleanup();
743 
744  ip2name_cleanup();
745  free_hostalias();
746  free_useralias();
747  userinfo_free();
748  if (userfile)
749  free(userfile);
750  close_usertab();
752 
753  end_time=time(NULL);
754 
755  if (show_statis) {
756  double elapsed=(double)end_time-(double)start_time;
757  debuga(__FILE__,__LINE__,_("Total execution time: %.0lf seconds\n"),elapsed);
758  if (read_elapsed>0.) {
759  debuga(__FILE__,__LINE__,_("Lines read: %lu lines in %.0lf seconds (%.0lf lines/s)\n"),lines_read,read_elapsed,(double)lines_read/read_elapsed);
760  }
761  if (process_elapsed>0.) {
762  debuga(__FILE__,__LINE__,_("Processed records: %lu records in %.0lf seconds (%.0lf records/s)\n"),records_kept,process_elapsed,(double)records_kept/process_elapsed);
763  debuga(__FILE__,__LINE__,_("Users: %lu users in %.0lf seconds (%.0lf users/s)\n"),nusers,process_elapsed,(double)nusers/process_elapsed);
764  }
765  }
766 
767  if (debug)
768  debuga(__FILE__,__LINE__,_("End\n"));
769 
770  exit(EXIT_SUCCESS);
771 }
772 
773 static void getusers(const char *pwdfile, int debug)
774 {
775  FILE *fp_usr;
776  char buf[255];
777  char *str;
778  long int nreg=0;
779 
780  if (debug)
781  debuga(__FILE__,__LINE__,_("Loading password file \"%s\"\n"),pwdfile);
782 
783  if ((fp_usr = fopen(pwdfile, "r")) == NULL) {
784  debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),pwdfile,strerror(errno));
785  exit(EXIT_FAILURE);
786  }
787 
788  if (fseek(fp_usr, 0, SEEK_END)==-1) {
789  debuga(__FILE__,__LINE__,_("Failed to move till the end of file \"%s\": %s\n"),pwdfile,strerror(errno));
790  exit(EXIT_FAILURE);
791  }
792  nreg = ftell(fp_usr);
793  if (nreg<0) {
794  debuga(__FILE__,__LINE__,_("Cannot get the size of file \"%s\"\n"),pwdfile);
795  exit(EXIT_FAILURE);
796  }
797  nreg = nreg+5000;
798  if (fseek(fp_usr, 0, SEEK_SET)==-1) {
799  debuga(__FILE__,__LINE__,_("Failed to rewind file \"%s\": %s\n"),pwdfile,strerror(errno));
800  exit(EXIT_FAILURE);
801  }
802 
803  if ((userfile=(char *) malloc(nreg))==NULL){
804  debuga(__FILE__,__LINE__,_("malloc error (%ld bytes required)\n"),nreg);
805  exit(EXIT_FAILURE);
806  }
807 
808  memset(userfile,0,nreg);
809  strcpy(userfile,":");
810 
811  while(fgets(buf,sizeof(buf),fp_usr)!=NULL) {
812  str=strchr(buf,':');
813  if (!str) {
814  debuga(__FILE__,__LINE__,_("Invalid user in file \"%s\"\n"),pwdfile);
815  exit(EXIT_FAILURE);
816  }
817  str[1]='\0';
818  strcat(userfile,buf);
819  }
820 
821  if (fclose(fp_usr)==EOF) {
822  debuga(__FILE__,__LINE__,_("Read error in \"%s\": %s\n"),pwdfile,strerror(errno));
823  exit(EXIT_FAILURE);
824  }
825 
826  return;
827 }
828 
829 static void CleanTemporaryDir()
830 {
831  if (!KeepTempLog && strcmp(tmp,"/tmp") != 0) {
832  unlinkdir(tmp,0);
833  }
834 }
ExcludeUsers
char ExcludeUsers[255]
Definition: conf.h:363
DATA_FIELD_USER
#define DATA_FIELD_USER
Definition: conf.h:202
REPORT_TYPE_USERS_SITES
#define REPORT_TYPE_USERS_SITES
Definition: conf.h:191
USERREPORTFIELDS_MILISEC
#define USERREPORTFIELDS_MILISEC
Definition: conf.h:231
MAX_REDIRECTOR_FILELEN
#define MAX_REDIRECTOR_FILELEN
Definition: conf.h:184
TitleFontSize
char TitleFontSize[5]
Definition: conf.h:410
FileListIter_NextWithMask
const char * FileListIter_NextWithMask(struct _FileListIterator *FIter)
Definition: filelist.c:487
langcode
int langcode
Definition: conf.h:488
TOPSITE_SORT_REVERSE
#define TOPSITE_SORT_REVERSE
Definition: conf.h:272
ReadLogDataStruct::UserFilter
bool UserFilter
True to filter on users.
Definition: defs.h:142
ReadFilter
struct ReadLogDataStruct ReadFilter
The log file filtering.
Definition: log.c:37
LogoImage
char LogoImage[20000]
Definition: conf.h:345
AnonymousOutputFiles
bool AnonymousOutputFiles
True to use anonymous file and directory names in the report.
Definition: conf.h:422
USERREPORTFIELDS_TOTAL
#define USERREPORTFIELDS_TOTAL
Definition: conf.h:233
TOPUSERFIELDS_MILISEC
#define TOPUSERFIELDS_MILISEC
Definition: conf.h:220
LDAPProtocolVersion
int LDAPProtocolVersion
Definition: conf.h:449
ReadLogDataStruct::SysUsers
bool SysUsers
True to restrict the log to the system users.
Definition: defs.h:146
cost
float cost
Definition: conf.h:508
MaxElapsed
char MaxElapsed[255]
Definition: conf.h:366
TOPUSERFIELDS_USED_TIME
#define TOPUSERFIELDS_USED_TIME
Definition: conf.h:219
append_to_path
void append_to_path(char *base_path, int base_path_size, const char *append)
Definition: util.c:2681
TopsitesSort
unsigned long int TopsitesSort
Definition: conf.h:331
DataFile
char DataFile[20000]
Definition: conf.h:380
FileList_IsEmpty
bool FileList_IsEmpty(FileListObject FObj)
Is the file list empty?
Definition: filelist.c:316
Ulimit
char Ulimit[6]
Definition: conf.h:440
debuga
void debuga(const char *File, int Line, const char *msg,...)
Definition: util.c:601
CleanTemporaryDir
static void CleanTemporaryDir()
Definition: log.c:829
USERREPORTFIELDS_SETYB
#define USERREPORTFIELDS_SETYB
Definition: conf.h:228
ShowReadPercent
bool ShowReadPercent
Definition: conf.h:392
RemoveTempFiles
bool RemoveTempFiles
Definition: conf.h:321
rc
int rc
Definition: conf.h:500
IndexSortOrder
char IndexSortOrder[5]
Definition: conf.h:393
TOPUSER_SORT_REVERSE
#define TOPUSER_SORT_REVERSE
Definition: conf.h:266
HostAliasFile
char HostAliasFile[512]
The name of the file containing the host names to replace by an alias in the report.
Definition: conf.h:459
getperiod_fromrange
void getperiod_fromrange(struct periodstruct *period, const struct ReadLogDataStruct *ReadFilter)
Definition: util.c:1088
Index
unsigned long int Index
Definition: conf.h:323
TempDir
char TempDir[20000]
Definition: conf.h:355
LDAPNativeCharset
char LDAPNativeCharset[20]
Character set to convert the LDAP returned string to.
Definition: conf.h:454
read_hostalias
void read_hostalias(const char *Filename)
Definition: url.c:575
site
char site[20000]
Definition: conf.h:433
UserAgentLog
FileListObject UserAgentLog
Definition: useragent.c:31
DansguardianFilterOutDate
bool DansguardianFilterOutDate
Definition: conf.h:395
PasswdFile
char PasswdFile[20000]
Definition: conf.h:354
UserInvalidChar
char UserInvalidChar[255]
Definition: conf.h:369
UserTabFile
char UserTabFile[255]
Definition: conf.h:333
INDEX_HTML_FILE
#define INDEX_HTML_FILE
Name of the html file containing the index of a report file.
Definition: conf.h:296
outdir
char outdir[20000]
Definition: conf.h:310
addr
char addr[20000]
Definition: conf.h:439
FontFace
char FontFace[20000]
Definition: conf.h:350
NumLogTotalErrors
int NumLogTotalErrors
Definition: conf.h:469
HeaderFontSize
char HeaderFontSize[5]
Definition: conf.h:409
USERREPORTFIELDS_USED_TIME
#define USERREPORTFIELDS_USED_TIME
Definition: conf.h:230
code
char code[20000]
Definition: conf.h:313
REALTIME_UNAUTH_REC_SHOW
#define REALTIME_UNAUTH_REC_SHOW
Definition: conf.h:261
RedirectorFilterOutDate
bool RedirectorFilterOutDate
Definition: conf.h:402
TOPUSERFIELDS_USERID
#define TOPUSERFIELDS_USERID
Definition: conf.h:214
TOPUSERFIELDS_IN_CACHE_OUT
#define TOPUSERFIELDS_IN_CACHE_OUT
Definition: conf.h:218
AuthfailReportLimit
int AuthfailReportLimit
Definition: conf.h:491
TOPUSERFIELDS_SETYB
#define TOPUSERFIELDS_SETYB
Definition: conf.h:217
FileListIter_Next
const char * FileListIter_Next(struct _FileListIterator *FIter)
Definition: filelist.c:427
FileList_AddFile
bool FileList_AddFile(FileListObject FObj, const char *FileName)
Definition: filelist.c:294
LDAPFilterSearch
char LDAPFilterSearch[512]
Definition: conf.h:451
LastLog
int LastLog
Definition: conf.h:320
DeniedReportLimit
int DeniedReportLimit
Definition: conf.h:492
RedirectorLogFormat
char RedirectorLogFormat[4096]
Definition: conf.h:398
KeepTempLog
bool KeepTempLog
True to keep the temporary files for inspection.
Definition: conf.h:505
AccessLogFromCmdLine
int AccessLogFromCmdLine
Definition: conf.h:338
DATETIME_BYTE
#define DATETIME_BYTE
Definition: conf.h:259
NRedirectorLogs
int NRedirectorLogs
Definition: conf.h:399
OutputDir
char OutputDir[20000]
Definition: conf.h:357
data_file
void data_file(char *tmp)
Definition: datafile.c:32
LDAPHost
char LDAPHost[255]
Definition: conf.h:445
USERREPORTFIELDS_AVERAGE
#define USERREPORTFIELDS_AVERAGE
Definition: conf.h:234
DATAFILEURL_IP
#define DATAFILEURL_IP
Definition: conf.h:252
ParsedOutputLog
char ParsedOutputLog[20000]
Definition: conf.h:406
HeaderBgColor
char HeaderBgColor[20000]
Definition: conf.h:352
_
#define _(String)
Definition: conf.h:155
AccessLog
FileListObject AccessLog
List of the input log files to process.
Definition: log.c:43
my_mkdir
bool my_mkdir(const char *name)
Definition: util.c:419
ReplaceIndex
char ReplaceIndex[256]
Definition: conf.h:322
REPORT_TYPE_DATE_TIME
#define REPORT_TYPE_DATE_TIME
Definition: conf.h:196
redirector_count
int redirector_count
Definition: conf.h:479
MAXLEN
#define MAXLEN
Definition: conf.h:176
REPORT_TYPE_TOPUSERS
#define REPORT_TYPE_TOPUSERS
Definition: conf.h:193
TempDirPath
char TempDirPath[20000]
Definition: conf.h:356
INDEX_TREE_FILE
#define INDEX_TREE_FILE
Definition: conf.h:241
TxColor
char TxColor[20000]
Definition: conf.h:342
realtime
void realtime(void)
Definition: realtime.c:173
FileListIter_Close
void FileListIter_Close(struct _FileListIterator *FIter)
Definition: filelist.c:530
close_usertab
void close_usertab(void)
Definition: usertab.c:478
gethexclude
void gethexclude(const char *hexfile, int debug)
Definition: exclude.c:184
SquidGuardReportLimit
int SquidGuardReportLimit
Definition: conf.h:496
BgColor
char BgColor[20000]
Definition: conf.h:340
Width
char Width[20000]
Definition: conf.h:348
periodstruct::start
struct tm start
The first date of the period.
Definition: conf.h:301
OutputEmail
char OutputEmail[20000]
Definition: conf.h:358
DATA_FIELD_ELAPSED
#define DATA_FIELD_ELAPSED
Definition: conf.h:210
LDAPPort
int LDAPPort
Definition: conf.h:448
USERREPORTFIELDS_BYTES
#define USERREPORTFIELDS_BYTES
Definition: conf.h:227
denied_cleanup
void denied_cleanup(void)
Definition: denied.c:291
DataFileFields
unsigned long int DataFileFields
Definition: conf.h:382
LogoTextColor
char LogoTextColor[20000]
Definition: conf.h:347
_FileListIterator
Iterator of the file list.
Definition: filelist.c:75
ConfigFile
char ConfigFile[20000]
Definition: conf.h:318
DISPLAY_ABBREV
#define DISPLAY_ABBREV
Definition: conf.h:256
is_indexonly
bool is_indexonly(void)
Definition: exclude.c:381
DansGuardianConf
char DansGuardianConf[20000]
Definition: conf.h:394
lines_read
unsigned long int lines_read
Count the number of lines read from the input log files.
Definition: conf.h:471
UserAuthentication
bool UserAuthentication
Definition: conf.h:419
unlinkdir
void unlinkdir(const char *dir, bool contentonly)
Definition: util.c:2339
DisplayedValues
unsigned long int DisplayedValues
Definition: conf.h:408
free_hostalias
void free_hostalias(void)
Definition: url.c:633
BgImage
char BgImage[20000]
Definition: conf.h:341
TOPUSERFIELDS_PTIME
#define TOPUSERFIELDS_PTIME
Definition: conf.h:221
DATA_FIELD_URL
#define DATA_FIELD_URL
Definition: conf.h:205
GraphDaysBytesBarColor
char GraphDaysBytesBarColor[255]
Definition: conf.h:371
userfile
char * userfile
The list of the system users.
Definition: log.c:40
makeTmpDir
void makeTmpDir(const char *tmp)
Definition: util.c:475
DateFormat
char DateFormat
Definition: conf.h:364
DATA_FIELD_BYTES
#define DATA_FIELD_BYTES
Definition: conf.h:207
convlog
void convlog(const char *arq, char df, const struct ReadLogDataStruct *ReadFilter)
Definition: convlog.c:30
UserSort
unsigned long int UserSort
Definition: conf.h:360
bindtextdomain
#define bindtextdomain(Domainname, Dirname)
Definition: gettext.h:88
INDEXFIELDS_DIRSIZE
#define INDEXFIELDS_DIRSIZE
Definition: conf.h:243
HeaderColor
char HeaderColor[20000]
Definition: conf.h:351
FileListStruct
List of files.
Definition: filelist.c:52
IndexFields
unsigned long int IndexFields
The columns to show in the index of the reports.
Definition: conf.h:418
ReadLogDataStruct::EndDate
int EndDate
Last date to include in the report. The format is year*10000+month+100+day.
Definition: defs.h:138
NTLMUSERFORMAT_DOMAINUSER
#define NTLMUSERFORMAT_DOMAINUSER
Definition: conf.h:246
ReportType
unsigned long int ReportType
Definition: conf.h:332
date_from
void date_from(struct ReadLogDataStruct *ReadFilter)
Definition: util.c:1619
GetLogPeriod
bool GetLogPeriod(struct tm *Start, struct tm *End)
Definition: readlog.c:915
textdomain
#define textdomain(Domainname)
Definition: gettext.h:86
authfail_cleanup
void authfail_cleanup(void)
Definition: authfail.c:299
TOPUSERFIELDS_DATE_TIME
#define TOPUSERFIELDS_DATE_TIME
Definition: conf.h:213
getperiod_buildtext
int getperiod_buildtext(struct periodstruct *period)
Definition: util.c:1136
FileList_Create
FileListObject FileList_Create(void)
Definition: filelist.c:106
TOPUSERFIELDS_TOTAL
#define TOPUSERFIELDS_TOTAL
Definition: conf.h:222
SortTableJs
char SortTableJs[256]
The full path to sorttable.js if the table in the reports must be dynamicaly sorted.
Definition: conf.h:457
free_exclude
void free_exclude(void)
Definition: exclude.c:387
IndexTree
unsigned long int IndexTree
How to display the index of the reports.
Definition: conf.h:416
email
char email[20000]
Definition: conf.h:435
CurrentLocale
char * CurrentLocale
Selected locale set through the environment variable.
Definition: log.c:45
UserReportLimit
int UserReportLimit
Definition: conf.h:497
TOPUSERFIELDS_CONNECT
#define TOPUSERFIELDS_CONNECT
Definition: conf.h:215
DATA_FIELD_OUT_CACHE
#define DATA_FIELD_OUT_CACHE
Definition: conf.h:209
ImageFile
char ImageFile[255]
Definition: conf.h:443
set_download_suffix
void set_download_suffix(const char *list)
Definition: download.c:345
ReadLogDataStruct::HostFilter
bool HostFilter
True to filter on hosts.
Definition: defs.h:140
TOPSITE_SORT_CONNECT
#define TOPSITE_SORT_CONNECT
Definition: conf.h:274
TOPUSER_SORT_BYTES
#define TOPUSER_SORT_BYTES
Definition: conf.h:267
ip2name_forcedns
void ip2name_forcedns(void)
Definition: ip2name.c:173
ReadLogDataStruct::StartTime
int StartTime
The start time to include in the report(H*100+M). Set to -1 to disable.
Definition: defs.h:148
TopUsersNum
int TopUsersNum
Definition: conf.h:329
USERREPORTFIELDS_PTIME
#define USERREPORTFIELDS_PTIME
Definition: conf.h:232
main
int main(int argc, char *argv[])
Definition: log.c:54
datetimeby
unsigned long int datetimeby
Definition: conf.h:367
usage
void usage(const char *prog)
Definition: usage.c:30
DATA_FIELD_CONNECT
#define DATA_FIELD_CONNECT
Definition: conf.h:206
load_excludecodes
void load_excludecodes(const char *ExcludeCodes)
Definition: util.c:1816
free_useralias
void free_useralias(void)
Definition: userinfo.c:364
TopUserFields
unsigned long int TopUserFields
Definition: conf.h:378
conf.h
Include headers and define global variables. */.
nocost
long long int nocost
Definition: conf.h:507
UserAliasFile
char UserAliasFile[512]
The name of the file containing the user names to replace by an alias in the report.
Definition: conf.h:461
ParsedOutputLogCompress
char ParsedOutputLogCompress[512]
Definition: conf.h:407
filelist.h
INDEX_ONLY
#define INDEX_ONLY
Definition: conf.h:238
df
char df
Definition: conf.h:319
userinfo_free
void userinfo_free(void)
Definition: userinfo.c:177
dataonly
bool dataonly
Definition: conf.h:485
ReadLogFile
int ReadLogFile(struct ReadLogDataStruct *Filter)
Definition: readlog.c:786
RealtimeUnauthRec
unsigned long int RealtimeUnauthRec
Definition: conf.h:444
INDEX_YES
#define INDEX_YES
Definition: conf.h:236
ExcludeString
char ExcludeString[20000]
Definition: conf.h:376
BytesInSitesUsersReport
bool BytesInSitesUsersReport
Definition: conf.h:404
USERREPORTFIELDS_CONNECT
#define USERREPORTFIELDS_CONNECT
Definition: conf.h:226
USERREPORTFIELDS_IN_CACHE_OUT
#define USERREPORTFIELDS_IN_CACHE_OUT
Definition: conf.h:229
free_download
void free_download(void)
Definition: download.c:324
css_content
void css_content(FILE *fp_css)
Definition: css.c:30
SuccessfulMsg
bool SuccessfulMsg
Definition: conf.h:377
DATA_FIELD_DATE
#define DATA_FIELD_DATE
Definition: conf.h:203
ReadLogDataStruct
Log filtering criterion.
Definition: defs.h:131
ExternalCSSFile
char ExternalCSSFile[20000]
Definition: conf.h:412
getconf
void getconf(const char *File)
Definition: getconf.c:982
ip2name_cleanup
void ip2name_cleanup(void)
Definition: ip2name.c:251
RedirectorLogFromCmdLine
int RedirectorLogFromCmdLine
Definition: conf.h:401
DownloadReportLimit
int DownloadReportLimit
Definition: conf.h:493
REPORT_TYPE_DENIED
#define REPORT_TYPE_DENIED
Definition: conf.h:197
REPORT_TYPE_USERAGENT
#define REPORT_TYPE_USERAGENT
Definition: conf.h:200
FileListIter_Open
FileListIterator FileListIter_Open(FileListObject FObj)
Definition: filelist.c:349
Height
char Height[20000]
Definition: conf.h:349
iprel
bool iprel
Definition: conf.h:487
read_useralias
void read_useralias(const char *Filename)
Definition: userinfo.c:317
ExcludeCodes
char ExcludeCodes[256]
Definition: conf.h:330
readlog.h
NtlmUserFormat
unsigned long int NtlmUserFormat
Definition: conf.h:414
SiteUsersReportLimit
int SiteUsersReportLimit
Definition: conf.h:494
LDAPTargetAttr
char LDAPTargetAttr[64]
Definition: conf.h:452
UserReportFields
unsigned long int UserReportFields
Definition: conf.h:379
Privacy
bool Privacy
Definition: conf.h:372
squid24
bool squid24
Definition: conf.h:503
IncludeUsers
char IncludeUsers[20000]
Definition: conf.h:375
TOPUSERFIELDS_NUM
#define TOPUSERFIELDS_NUM
Definition: conf.h:212
LDAPBaseSearch
char LDAPBaseSearch[255]
Definition: conf.h:450
realtime_refresh
int realtime_refresh
Definition: conf.h:498
ShowSargInfo
bool ShowSargInfo
Definition: conf.h:403
TiColor
char TiColor[20000]
Definition: conf.h:344
dansguardian_count
int dansguardian_count
Definition: conf.h:478
REPORT_TYPE_DOWNLOADS
#define REPORT_TYPE_DOWNLOADS
Definition: conf.h:199
PrivacyString
char PrivacyString[255]
Definition: conf.h:373
gerarel
void gerarel(const struct ReadLogDataStruct *ReadFilter)
Definition: report.c:50
AuthUserTemplateFile
char AuthUserTemplateFile[1024]
Definition: conf.h:420
ShowSargLogo
bool ShowSargLogo
Definition: conf.h:405
version
void version(void)
Definition: util.c:2300
FontSize
char FontSize[20000]
Definition: conf.h:353
REPORT_TYPE_AUTH_FAILURES
#define REPORT_TYPE_AUTH_FAILURES
Definition: conf.h:198
TOPUSERFIELDS_BYTES
#define TOPUSERFIELDS_BYTES
Definition: conf.h:216
getuexclude
void getuexclude(const char *uexfile, int debug)
Definition: exclude.c:310
download_cleanup
void download_cleanup(void)
Definition: download.c:453
us
char us[50]
Definition: conf.h:434
USER_SORT_REVERSE
#define USER_SORT_REVERSE
Definition: conf.h:278
safe_strcpy
void safe_strcpy(char *dest, const char *src, int length)
Definition: util.c:1550
LDAPBindPW
char LDAPBindPW[255]
Definition: conf.h:447
NumLogSuccessiveErrors
int NumLogSuccessiveErrors
The number of consecutive errors allowed in an input log file before the process is interrupted.
Definition: conf.h:463
SquidGuardConf
char SquidGuardConf[20000]
Definition: conf.h:396
ReadLogDataStruct::EndTime
int EndTime
The end time to include in the report(H*100+M). Set to -1 to disable.
Definition: defs.h:150
PrivacyStringColor
char PrivacyStringColor[30]
Definition: conf.h:374
tmp
char tmp[20000]
Definition: conf.h:315
RealtimeTypes
char RealtimeTypes[1024]
Definition: conf.h:441
getusers
static void getusers(const char *pwdfile, int debug)
Definition: log.c:773
useragent_count
int useragent_count
Definition: conf.h:480
USER_SORT_BYTES
#define USER_SORT_BYTES
Definition: conf.h:279
TopuserSort
unsigned long int TopuserSort
Definition: conf.h:359
defs.h
Declaration of the structures and functions.
CharSet
char CharSet[255]
Definition: conf.h:368
MAX_REDIRECTOR_LOGS
#define MAX_REDIRECTOR_LOGS
Definition: conf.h:183
splitlog
void splitlog(const char *arq, char df, const struct ReadLogDataStruct *ReadFilter, int convert, const char *splitprefix)
Definition: splitlog.c:46
LogoText
char LogoText[20000]
Definition: conf.h:346
free_excludecodes
void free_excludecodes(void)
Definition: util.c:1874
LDAPBindDN
char LDAPBindDN[512]
Definition: conf.h:446
REPORT_TYPE_SITES_USERS
#define REPORT_TYPE_SITES_USERS
Definition: conf.h:195
REPORT_TYPE_TOPSITES
#define REPORT_TYPE_TOPSITES
Definition: conf.h:194
DataFileDelimiter
char DataFileDelimiter[3]
Definition: conf.h:381
BlockIt
char BlockIt[255]
Definition: conf.h:413
RecordsWithoutUser
unsigned long int RecordsWithoutUser
Definition: conf.h:325
RedirectorLogs
char RedirectorLogs[64][1024]
Definition: conf.h:400
DansGuardianReportLimit
int DansGuardianReportLimit
Definition: conf.h:495
ReadLogDataStruct::DateRange
char DateRange[255]
The filtering date range.
Definition: defs.h:134
debugz
int debugz
Definition: conf.h:490
period
struct periodstruct period
Definition: conf.h:312
ExcludeHosts
char ExcludeHosts[255]
Definition: conf.h:362
TopSitesNum
int TopSitesNum
Definition: conf.h:328
realtime_access_log_lines
int realtime_access_log_lines
Definition: conf.h:499
DataFileUrl
unsigned long int DataFileUrl
Definition: conf.h:383
Title
char Title[20000]
Definition: conf.h:339
indexonly
bool indexonly
Definition: conf.h:486
MailUtility
char MailUtility[PATH_MAX]
Definition: conf.h:327
VERSION
#define VERSION
Definition: info.h:1
ShowReadStatistics
bool ShowReadStatistics
if true, show the number of lines read from the input log file during the reading of the file.
Definition: conf.h:385
FileList_Destroy
void FileList_Destroy(FileListObject *FPtr)
Definition: filelist.c:140
TOPUSERFIELDS_AVERAGE
#define TOPUSERFIELDS_AVERAGE
Definition: conf.h:223
RECORDWITHOUTUSER_IP
#define RECORDWITHOUTUSER_IP
Definition: conf.h:248
ReadLogDataStruct::StartDate
int StartDate
First date to include in the report. The format is year*10000+month+100+day.
Definition: defs.h:136
nusers
unsigned long int nusers
Count the number of users.
Definition: conf.h:475
periodstruct::end
struct tm end
The last date of the period.
Definition: conf.h:303
UserIp
bool UserIp
Definition: conf.h:365
LongUrl
bool LongUrl
Definition: conf.h:336
records_kept
unsigned long int records_kept
Count the number of records kept for the processing.
Definition: conf.h:473
OverwriteReport
bool OverwriteReport
Definition: conf.h:324
REPORT_TYPE_SITE_USER_TIME_DATE
#define REPORT_TYPE_SITE_USER_TIME_DATE
Definition: conf.h:192
debug
int debug
Definition: conf.h:489
TxBgColor
char TxBgColor[20000]
Definition: conf.h:343
DATA_FIELD_IN_CACHE
#define DATA_FIELD_IN_CACHE
Definition: conf.h:208
DATA_FIELD_TIME
#define DATA_FIELD_TIME
Definition: conf.h:204
Ip2Name
bool Ip2Name
Definition: conf.h:337
UseComma
bool UseComma
Definition: conf.h:326
ReadLogDataStruct::max_elapsed
long int max_elapsed
Maximum elpased time allowed. Any time greater than this value is set to zero.
Definition: defs.h:144
UserAgentFromCmdLine
bool UserAgentFromCmdLine
Set to true if a useragent log is provided on the command line.
Definition: log.c:47
Graphs
bool Graphs
Definition: conf.h:370
GraphFont
char GraphFont[20000]
Definition: conf.h:455