August 5th, 2003, 02:37 PM
-
process records from stdin
Hello,
I have this problem. I have this log file which is continiously written. I tail out into another process to parse these records and write a tab delimited file.
here is the command
tail -f /logs/access_log | ./parser.o
In the parser.c I have this code
....
....
....
while(endFlg == 0)
{
...
...
...
do
{
// If End of file is reached break from the do...while loop
ptmp = fgets(atmp, sizeof(atmp), stdin);
if(ptmp == NULL)
{
endFlg = 1;
break;
}
//Initialize the structure
printf("%s\n","Start 2nd.............");
memset(fileStr,'\0',sizeof(fileStr));
memset(&logentry,0,sizeof(logentry));
...
...
}while ( time < 300)
....
....
}
Now the problem is not all the records from the log file gets logged. It almost skips 1/3 of the records.If I have 150 records in /logs/access_log I get only 50 output records
Where does it store the record before reading it into the process...Am I missing some of the records as I am parsing....???
This is in C coding
Thanks in Advance