Can I delete first few lines from a running log file?
by james000 from LinuxQuestions.org on (#6F6F9)
Hello,
This is RedHat 7 and I have a big log file of 12gb. Logs are constantly writing to it, so I can't rename file. This filesystem have only 4 gb space left, so I can't use logrotate also, for rotating 12gb file.
One solution I can think is, delete first half of lines (approx 32,231,354) and that would make this file size to 6gb.
Can someone suggest, how can I truncate older lines from this log file?
Code:[root@linux-7 ~]# cat /var/log/drtmessages | wc -l
64462709
[root@linux-7 ~]#Thanks
This is RedHat 7 and I have a big log file of 12gb. Logs are constantly writing to it, so I can't rename file. This filesystem have only 4 gb space left, so I can't use logrotate also, for rotating 12gb file.
One solution I can think is, delete first half of lines (approx 32,231,354) and that would make this file size to 6gb.
Can someone suggest, how can I truncate older lines from this log file?
Code:[root@linux-7 ~]# cat /var/log/drtmessages | wc -l
64462709
[root@linux-7 ~]#Thanks