Copy last line of file to another file if the size of the first file is increasing

Hi, i wrote the output of some logs to a file called interface_up. I would like to copy the last line of this file to another file compare.txt ( lines in this file will be overwrite each time).

Can you help me please?

output {
if [message] =~ "changed state to up" {
file { path => "/home/adrian/from_logstash/interface_up" write_behavior => "append" }
} else if [message] =~ "changed state to down" or [message] =~ "changed state to administratively down" {
file { path => "/home/adrian/from_logstash/interface_down" }
} else {
file { path => "/home/adrian/from_logstash/other_events" }

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.