|
Hi, To all those unfortunate souls that, like myself, webmaster an Oracle-powered Web Site, and are unable to use third-part log analyzer with that weird logfile format... I spent some time writing and debugging this tiny C program (instead of going to the beach), just to give us a chance to get our site's accesses analyzed. Cut the code below, compile it and use as a filter. It accepts an Oracle Logfile as stdin, and outputs a fixed "NCSA/common" format logfile. I don't have yet a very large log file, so I was not able to test this program against every possible entry in the logfile, but it seems to work well. After I run the filter, I was able to use analog, wusage, ftpweblog, accesswatch, etc... So, here is it, enjoy. Any doubt on using the code, send me an e-mail. Anybody please feel free to alter and improve the code. Bye.
/* CODE STARTS HERE */ /* LOGFILT.C : A PROGRAM TO FIX ORACLE WEB LOG FILES */ /* BY NAVA@USP.BR */ /* 12/DEC/96 */ /* */ /* just ANSI-compile this program: */ /* cc -Aa logfilt.c -o logfilt (it should work) */ /* and use it to generate a new (fixed) log file, */ /* by means of redirecting stdin and stdout: */ /* logfilt < your_oracle_log_file > fixed_log_file */ /* now you may use any log analyzer you want! */
#include <stdio.h>
void main(void);
void main(void)
{
short int c;
char buffer[27];
while (1)
{
c=getchar();
if (feof(stdin)) break;
if (c=='[')
{
putchar(c);
c=getchar();
if (c==']')
{
putchar(c);
continue;
}
scanf("%4c",buffer);
scanf("%24c",buffer);
buffer[2]='/';
buffer[6]='/';
buffer[11]=':';
buffer[21]='+';
buffer[22]='0';
buffer[23]='0';
buffer[24]='0';
buffer[25]='0';
buffer[26]=0;
printf(buffer);
}
else putchar(c);
}
}
/* CODE ENDS HERE */
|
| Inline: | Outline: |
|
to: |
|
|