debugs(3, 9, "possible " << cl->filename << " logformat: " << logdef_name);
if (cl->type != Log::Format::CLF_UNKNOWN) {
- debugs(3, DBG_CRITICAL, "Second logformat name in one access_log: " <<
+ debugs(3, DBG_CRITICAL, "FATAL: Second logformat name in one access_log: " <<
logdef_name << " " << cl->type << " ? " << Log::Format::CLF_NONE);
self_destruct();
return false;
} else if (strcmp(logdef_name, "referrer") == 0) {
cl->type = Log::Format::CLF_REFERER;
} else if (dieWhenMissing) {
- debugs(3, DBG_CRITICAL, "Log format '" << logdef_name << "' is not defined");
+ debugs(3, DBG_CRITICAL, "FATAL: Log format '" << logdef_name << "' is not defined");
self_destruct();
return false;
} else {
break;
case Log::Format::CLF_SQUID:
- storeAppendPrintf(entry, "%s logformat=squid", log->filename);
+ // this is the default, no need to add to the dump
+ //storeAppendPrintf(entry, "%s logformat=squid", log->filename);
break;
case Log::Format::CLF_COMBINED:
char *name, *def;
if (!(name = ConfigParser::NextToken())) {
+ debugs(3, DBG_CRITICAL, "FATAL: missing logformat details in " << cfg_filename << " line " << config_lineno);
self_destruct();
+ return;
+ }
+
+ // check for re-definition of built-in formats
+ if (strcmp(name, "squid") == 0 ||
+ strcmp(name, "common") == 0 ||
+ strcmp(name, "combined") == 0 ||
+ strcmp(name, "useragent") == 0 ||
+ strcmp(name, "referrer") == 0) {
+ debugs(3, DBG_PARSE_NOTE(DBG_IMPORTANT), "ERROR: logformat " << name << " is already defined. Ignoring.");
+ return;
+ }
+
+ // check for re-definition of custom formats
+ for (auto i = logformats; i ; i = i->next) {
+ if (strcmp(i->name, name) == 0) {
+ debugs(3, DBG_PARSE_NOTE(DBG_IMPORTANT), "ERROR: logformat " << name << " is already defined. Ignoring.");
+ return;
+ }
}
::Format::Format *nlf = new ::Format::Format(name);