Remove first N lines from an active log file without logrotate

0

Is there a way to remove the first N lines from a log that is being actively appended by an application without using logrotate? (opkg install logrotate -returns: Unknow package 'logrotate')

Helena Silva

Posted 2016-12-22T19:25:29.667

Reputation: 1

Answers

-1

The best answer install logrotate. Next

tail -n +10 /var/log/whatever.log

replace the +10 with any number, but be sure to keep the + symbol.

cybernard

Posted 2016-12-22T19:25:29.667

Reputation: 11 200

-1

Sed is the easiest solution to manipulate text files:

sed -i '1,Nd' /path_to_log

Serhat Cevikel

Posted 2016-12-22T19:25:29.667

Reputation: 219