I have this code for the tail of deleted log files:
def do_tail( session, file ) session.open_channel do |channel| channel.on_data do |ch, data| puts "[#{file}] -> #{data}" end channel.exec "tail -f #{file}" end Net::SSH.start("host", "user", :password => "passwd") do |session| do_tail session, "/path_to_log/file.log" session.loop
I want to get only the lines with the string "ERROR" in the .log file, I try to call "tail -f # {file} | grep ERROR", but to no avail.
Thanks in advance.
source share