howto watch a rotating file with node.js?

Viewed 316

I'm trying to watch log rotated files with node.js and parse each line for keywords. The Problem is: after logrotate I'm still watching the old file because of the opened file discriptor.

I'm new to this and have two questions:

  1. Is it advisable to check after every line the inode and if it's not the same close the fd and read the file 'filename' again?
  2. What's the best way achieving this? Trying to avoid callbacks and use events instead or is there an library already?

Thanks!

1 Answers
Related