> 
> It sounds as if you really want to know whether the log file has been
> updated between one invocation of your program and the next. Is that
> it? (It's helpful to tell us what you want to accomplish, not just how
> you hope to accomplish it. Storing a byte position into a temporary
> file is how you want to do something, but you haven't told us what
> you're trying to accomplish by doing that.)
> 
> Saving the tell() location of the last line of the log file isn't a
> reliable way to find that point in the file at a later date,
> generally, because log files may be rotated. That is, the file with
> that name on a later date may be a different file altogether; in that
> case seek() has no hope of finding the right location.
> 
> Maybe you want to save the last timestamp seen during one invocation,
> so that the next invocation can continue examining the log from the
> first timestamp that occurred after that one?
> 
> If I haven't been able to guess what you're trying to accomplish,
> please ask again. Good luck with it!
> 
> --Tom Phoenix
> Stonehenge Perl Training



Thanks for your response..


My requirement is reading the log file and then make some
calculations.... I don't want read the  whole file at every time..
because the log file size is increased then it take more time to read...

First time read the full log file after that reading only the updated
lines
If suppose, the log is rotated then read the lines starting from when it
was last read 


Method i have followed,

For that i have used the tell and seek method.. in that, first time
reading the whole file and then store the the byte position of the line
before the last line and time stamp to one temporary file...

next time opening the temporary file and seek the file position from
current log file(access.log), and get the time stamp of that line,
compare  that with already stored time stamp, if both are equal the
continue the reading process, otherwise (log is rotated) seek the file
position from previous log file(access.log.0) and compare the time
stamp, if both are equal then proceed the reading lines from that file
and current log file.. both are not equal then checking from previous
file(access.log.1)...and so on..


problem:
in that i cant able to get the byte position of the line before the last
line from file..

it shows the following error,

Can't use string ("1193892901.686") as a SCALAR ref while "strict refs"
in use at telseek.pl_ line



Thanks,
Siva 

Reply via email to