{"auth_failures",REPORT_TYPE_AUTH_FAILURES,0},
{"site_user_time_date",REPORT_TYPE_SITE_USER_TIME_DATE,0},
{"downloads",REPORT_TYPE_DOWNLOADS,0},
+ {"user_agent",REPORT_TYPE_USERAGENT,0},
};
static struct param_list data_field_values[]=
#define REPORT_TYPE_DENIED 0x0040UL
#define REPORT_TYPE_AUTH_FAILURES 0x0080UL
#define REPORT_TYPE_DOWNLOADS 0x0100UL
+#define REPORT_TYPE_USERAGENT 0x0200UL
#define DATA_FIELD_USER 0x0001UL
#define DATA_FIELD_DATE 0x0002UL
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);
#
# Wildcards are allowed (see access_log).
#
+# When this option is used the user_agent report is implicitly
+# selected in report_type.
+#
#useragent_log none
# TAG: date_format
# TAG: report_type type
# What kind of reports to generate.
# topusers - users, sites, times, bytes, connects, links to accessed sites, etc
-# topsites - site, connect and bytes report
-# sites_users - users and sites report
-# users_sites - accessed sites by the user report
-# date_time - bytes used per day and hour report
-# denied - denied sites with full URL report
+# topsites - site, connect and bytes report
+# sites_users - users and sites report
+# users_sites - accessed sites by the user report
+# date_time - bytes used per day and hour report
+# denied - denied sites with full URL report
# auth_failures - autentication failures report
# site_user_time_date - sites, dates, times and bytes report
# downloads - downloads per user report
+# user_agent - user agent identification strings report (this report is always selected
+# if at least one file is provided with useragent option)
#
# Eg.: report_type topsites denied
#
-#report_type topusers topsites sites_users users_sites date_time denied auth_failures site_user_time_date downloads
+#report_type topusers topsites sites_users users_sites date_time denied auth_failures site_user_time_date downloads user_agent
# TAG: usertab filename
# You can change the "userid" or the "ip address" to be a real user name on the reports.
*/
FILE *UserAgent_Open(void)
{
- FILE *fp_ou;
+ FILE *fp_ou=NULL;
if (UserAgentTempLog[0]) {
debuga(__FILE__,__LINE__,_("Useragent log already opened\n"));
exit(EXIT_FAILURE);
}
- snprintf(UserAgentTempLog,sizeof(UserAgentTempLog),"%s/squagent.int_unsort",tmp);
- if ((fp_ou=fopen(UserAgentTempLog,"w"))==NULL) {
- debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),UserAgentTempLog,strerror(errno));
- exit(EXIT_FAILURE);
+ if ((ReportType & REPORT_TYPE_USERAGENT)!=0) {
+ snprintf(UserAgentTempLog,sizeof(UserAgentTempLog),"%s/squagent.int_unsort",tmp);
+ if ((fp_ou=fopen(UserAgentTempLog,"w"))==NULL) {
+ debuga(__FILE__,__LINE__,_("Cannot open file \"%s\": %s\n"),UserAgentTempLog,strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+ memset(&UserAgentStartDate,0,sizeof(UserAgentStartDate));
+ memset(&UserAgentEndDate,0,sizeof(UserAgentEndDate));
}
- memset(&UserAgentStartDate,0,sizeof(UserAgentStartDate));
- memset(&UserAgentEndDate,0,sizeof(UserAgentEndDate));
return(fp_ou);
}
*/
void UserAgent_Write(FILE *fp,const char *Ip,const char *User,const char *Agent)
{
- fprintf(fp,"%s\t%s\t%s\n",Ip,Agent,User);
- useragent_count++;
+ if (fp) {
+ fprintf(fp,"%s\t%s\t%s\n",Ip,Agent,User);
+ useragent_count++;
+ }
}
/*!
double perc;
struct getwordstruct gwarea;
- if (!UserAgentTempLog[0]) return;
+ if (!UserAgentTempLog[0] || useragent_count==0) return;
snprintf(tmp2,sizeof(tmp2),"%s/squagent.int_log",tmp);
if (debug) {