tags:

views:

22

answers:

1

Hi,

I am watching a log file using FSSM. So far, this works fine.

FSSM informs me whenever the file gets updated. But how can I detect the new log entries without manipulating the given log file?

My current code is:

FSSM::Monitor.new.path(Dir.pwd, file) do
      update { |base, relative|
          puts "Change detected (#{file}): Base: #{base} Relative:#{relative}"
      }
end

Best regards

A: 

if you're looking to basically tail the file, you'll want to keep an open handle to that file, and position it at the end. Then, when new stuff is added, you just read from that handle and it should read you the "new stuff"

rogerdpack