if ((str = strchr(code, ':')) != NULL)
*str = '/';
+ log_entry.HttpCode=code;
ilf=ILF_Common;
ilf_count[ilf]++;
debuga(_("Maybe you have a broken result code in your %s file\n"),arq);
exit(EXIT_FAILURE);
}
+ log_entry.HttpCode=code;
if (getword_atoll(&log_entry.DataSize,&gwarea,' ')<0){
debuga(_("Maybe you have a broken amount of data in your %s file\n"),arq);
exit(EXIT_FAILURE);
debuga(_("Maybe you have a broken record or garbage in your %s file\n"),arq);
exit(EXIT_FAILURE);
}
+ log_entry.HttpCode=code;
if (getword_atol(&log_entry.ElapsedTime,&gwarea,'\t')<0){
debuga(_("Maybe you have a broken record or garbage in your %s file\n"),arq);
exit(EXIT_FAILURE);
}
if(strcmp(code,"401") == 0 || strcmp(code,"403") == 0 || strcmp(code,"407") == 0) {
- sprintf(val1,"DENIED/%s",code);
- strcpy(code,val1);
+ static char valcode[12];
+ sprintf(valcode,"DENIED/%s",code);
+ log_entry.HttpCode=valcode;
+ } else {
+ log_entry.HttpCode=code;
}
getword_start(&gwarea,data);
if (getword_atoll(&iyear,&gwarea,'-')<0){
continue;
}
- if(vercode(code)) {
- if (debugm) printf(_("Excluded code: %s\n"),code);
+ if(vercode(log_entry.HttpCode)) {
+ if (debugm) printf(_("Excluded code: %s\n"),log_entry.HttpCode);
totregsx++;
continue;
}
// replace any tab by a single space
for (str=full_url ; *str ; str++)
if (*str=='\t') *str=' ';
- for (str=code ; *str ; str++)
+ for (str=log_entry.HttpCode ; *str ; str++)
if (*str=='\t') *str=' ';
if(ilf!=ILF_Sarg) {
strftime(dia, sizeof(dia), "%d/%m/%Y", log_entry.EntryTime);
strftime(hora,sizeof(hora),"%H:%M:%S",log_entry.EntryTime);
- if (fprintf(ufile->file, "%s\t%s\t%s\t%s\t%"PRIu64"\t%s\t%ld\t%s\n",dia,hora,log_entry.Ip,url,(uint64_t)log_entry.DataSize,code,log_entry.ElapsedTime,smartfilter)<=0) {
+ if (fprintf(ufile->file, "%s\t%s\t%s\t%s\t%"PRIu64"\t%s\t%ld\t%s\n",dia,hora,log_entry.Ip,url,(uint64_t)log_entry.DataSize,log_entry.HttpCode,log_entry.ElapsedTime,smartfilter)<=0) {
debuga(_("Write error in the log file of user %s\n"),log_entry.User);
exit(EXIT_FAILURE);
}
if(fp_log && ilf!=ILF_Sarg)
- fprintf(fp_log, "%s\t%s\t%s\t%s\t%s\t%"PRIu64"\t%s\t%ld\t%s\n",dia,hora,log_entry.User,log_entry.Ip,url,(uint64_t)log_entry.DataSize,code,log_entry.ElapsedTime,smartfilter);
+ fprintf(fp_log, "%s\t%s\t%s\t%s\t%s\t%"PRIu64"\t%s\t%ld\t%s\n",dia,hora,log_entry.User,log_entry.Ip,url,(uint64_t)log_entry.DataSize,log_entry.HttpCode,log_entry.ElapsedTime,smartfilter);
totregsg++;
- if(!dataonly && download_flag && strstr(code,"DENIED") == 0) {
+ if(!dataonly && download_flag && strstr(log_entry.HttpCode,"DENIED") == 0) {
ndownload = 1;
if ( ! fp_Download_Unsort ) {
fprintf(fp_Download_Unsort,"%s\t%s\t%s\t%s\t%s\n",dia,hora,log_entry.User,log_entry.Ip,download_url);
}
- if(fp_denied && strstr(code,"DENIED/403") != 0) {
+ if(fp_denied && strstr(log_entry.HttpCode,"DENIED/403") != 0) {
fprintf(fp_denied, "%s\t%s\t%s\t%s\t%s\n",dia,hora,log_entry.User,log_entry.Ip,full_url);
denied_count++;
}
if((ReportType & REPORT_TYPE_AUTH_FAILURES) != 0) {
- if(fp_authfail && (strstr(code,"DENIED/401") != 0 || strstr(code,"DENIED/407") != 0)) {
+ if(fp_authfail && (strstr(log_entry.HttpCode,"DENIED/401") != 0 || strstr(log_entry.HttpCode,"DENIED/407") != 0)) {
fprintf(fp_authfail, "%s\t%s\t%s\t%s\t%s\n",dia,hora,log_entry.User,log_entry.Ip,full_url);
authfail_count++;
}
printf("TIME=\t%s\n",hora);
printf("FUNC=\t%s\n",fun);
printf("URL=\t%s\n",url);
- printf("CODE=\t%s\n",code);
+ printf("CODE=\t%s\n",log_entry.HttpCode);
printf("LEN=\t%"PRIu64"\n",(uint64_t)log_entry.DataSize);
}
}