Wonder if anyone can help.
I have a log which starts from Dec 4 and is constantly updated. Rather than empty the log, I want to just keep the last 7 days worth.
I have tried find . -mtime +7 , but this cmd works well when looking for files within a filesystem, I want to just edit that log file ,
I have tried some awk cmds, but unsure how to progress further .
Dec 4 21:49:10 cspcws snmpd[8776]: NOTICE: SMUX relation started with (172.30.5.253+54268+985) is the start of the log
Jan 2 23:38:36 cspcws snmpd[8776]: EXCEPTIONS: simpleOpen rejected (badIdentity): enterprises.1031.1.1 (SMUX 172.30.5.253+50404+2371)
Is the end of the file
I have a log which starts from Dec 4 and is constantly updated. Rather than empty the log, I want to just keep the last 7 days worth.
I have tried find . -mtime +7 , but this cmd works well when looking for files within a filesystem, I want to just edit that log file ,
I have tried some awk cmds, but unsure how to progress further .
Dec 4 21:49:10 cspcws snmpd[8776]: NOTICE: SMUX relation started with (172.30.5.253+54268+985) is the start of the log
Jan 2 23:38:36 cspcws snmpd[8776]: EXCEPTIONS: simpleOpen rejected (badIdentity): enterprises.1031.1.1 (SMUX 172.30.5.253+50404+2371)
Is the end of the file