Maybe I'm going about this all wrong...
I want to exclude HEAD requests with Analog 3.11. I decided to dive
into the source code and see what I could do (stop me if there's an
easier way!).
So... I won't ask anyone to debug my code changes, but can anyone
offer any clues to the following.... I'm hoping this will remind
someone of something I'm missing....
The error:
This happens when I have a DEFAULTLOGFORMAT in one cfg file, but then
override this with a LOGFORMAT command in a later cfg file. I do
this because most of my log files are in COMBINED format, but I have
one which is in MS IIS4 format.
Program received signal SIGSEGV, Segmentation fault.
0x80516d0 in correct (op=0x80778d8) at init.c:1514
The lines in question are:
1512 /* change logformats to ignore items which are not wanted
(see 28/10/9
7) */
1513 for (lp = op -> miscopts.logfile; lp != NULL; TO_NEXT(lp)) {
1514 if (lp -> format -> form -> inpfns -> fn == &parselogfmt
&&
1515 lp -> format -> form -> sep == '0') /* DEFAULT
format */
1516 lp -> format = deflogformat;
1517 }
lp->format is fine. lp->format->form (type Inputformat*) cannot be
accessed (pointing to some bad memory location).
(I'm running Linux 2.0.34, Redhat 5.1)
In my main analog.cfg file I have:
# %G is a custom change for rejecting HEAD requests
DEFAULTLOGFORMAT (%S %j %u [%d/%M/%Y:%h:%n:%j] "%G %r %j" %c %b "%
f" "%B")
(I decribe my changes for %G below)
And in another cfg file, just before I open the LOGFILE I have:
LOGFORMAT (%Y-%m-%d %h:%n:%j %S - %j %r %q %c %b %A %u %f)
Note: I don't even use %G in this format string.
I do NOT get the segmentation fault if:
1. I just go with the DEFAULTLOGFORMAT (don't use LOGFORMAT)
2. Use neither DEFAULTLOGFORMAT or LOGFORMAT (go with the analog AUTO)
The changes I've made to the code:
I've added a %G to the logformat to use to store the METHOD (get,
post, head, whatever) which replaces the use of %j. To do this I
created a ITEM_METHOD to the enum in analhea2.h (before INP_CODE)
and then mapped %G to parsestring in init.c:
{'G', ITEM_METHOD, &parsestring, &mm[ITEM_METHOD]}
The final change was to process.c:process_data(). I've hard coded
this test as the very first test in process_data():
method = (char *)(mm[ITEM_METHOD].curr_pos);
if (method != NULL && strlen(method) > 3 && strcmp(method, "HEAD")
== 0)
{
/* A HEAD request */
printf("Dumping: [%s]\n", method);
logfilep -> data[LOGDATA_UNKNOWN]++;
return;
}
And this performs as I expect: HEAD requests are removed from my
reports.
Another change I made, was to replace the reading of browser
(user_agent) to make the user_agent string lowercase, because I
wanted case-insensitive matching on the user agent for excluding
robots.
Any ideas?
Cheers
Richard
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
--------------------------------------------------------------------
This is the analog-help mailing list. To unsubscribe from this
mailing list, send mail to [EMAIL PROTECTED]
with "unsubscribe analog-help" in the main BODY OF THE MESSAGE.
--------------------------------------------------------------------