Sample Header Ad - 728x90

Best Practice: How to maintain/rotate log files (from redirected output)

1 vote
1 answer
1637 views
I read several question for the mentioned topic, but I'm not sure if they really answer the question for my problem. I have an application running and I redirect the output to a log file, i.e., nohup ./start.sh ./config/s.properties >./logs/app.log 2>&1 & The file is now 80GB in size and I would like to delete it. Most of the answers here suggest not to delete it, because the data will still be written to the "deleted" file. Answers suggest to use logrotate instead, but I'm wondering if logrotate works with redirected output? If it does work, what would the configuration look like? Do I need any postrotate command? I should mention that it is impossible for me to stop and restart the running application, thus I would just like to "steal" the file and let the running application write to a new one. If logrotate is not the solution, what should I do - again I cannot stop and restart the running application - so that I can reduce the file-size? Thanks for any help! PS: Just to mention the application is running on a Debian8 64 OS
Asked by Philipp (191 rep)
May 14, 2018, 09:19 PM
Last activity: Sep 2, 2022, 07:07 PM