[2019-02-11 10:18:18] GET / [2019-02-11 11:18:19] POST blavadasdasdgd ... ... <--- A lot of in between logs and other data ... [2019-02-12 11:18:20] INFO ::HTTPServer#start: pid=21378 port=4567 [12/Mar/2019:11:18:25 +0200] "GET / HTTP/1.1" 404 458 0.0086 [12/Mar/2019:11:18:26 EET] "GET / HTTP/1.1" 404 458 - -> / [12/Mar/2019:11:18:27 +0200] "GET /" 200 18893 0.0020 [2019-03-12 11:18:28] GET / [2019-03-12 12:18:29] POST blablabla ... ... <--- A lot of in between logs and other data ... [13/Mar/2019:11:18:30 +0200] "GET / HTTP/1.1" 404 458 0.0086 [13/Mar/2019:11:18:31 EET] "GET / HTTP/1.1" 404 458 - -> / [13/Mar/2019:11:18:32 +0200] "GET /" 200 18893 0.0020 ... ... <--- A lot of in between logs and other data ... [2019-03-14 11:19:18] GET /
The content of this file is fake (but the timestamps are in the correct order older to newer)
I have a webserver that is running through nohup and outputting everything to a file called
production.log and is writing around (+10GB) of data and info to it and I want to truncate it in a way to maintain some good amount of recent logs and data inside it, but getting rid of the old data.
So I'm taking an approximate guess of tailing the last 30,000 lines outputting them into a new file called
production.log.1 and then move it back and replace it with
tail -30000 production.log > production.log.1 && mv production.log.1 production.log
Now when I try to
tail -f production.log it never outputs anything new from the webserver but instead it only keeps showing the last timestamp log before i managed to replace the file. The webserver just stops writing into it.
is there a better or a good way to do this without writing into a different file? I need to get rid of the old data from this site while keeping 2>&1 outputting to it from the webserver.