For some reason I'm not being able to use logotate to compress files periodically.
So I decided to write my own script, it's not the most hard thing but one small detail is pinning me down.
When using zip to compress the file , logrotate keeps the original files and empty them. I can use gzip then echo to achieve the same result but assuming my application is writing a lot of data into logs , there will be certainly some lost logs in timestamps after running gzip and before echo
gzip -k file.log echo "" > file.log
Any idea how can I make it ? Am I missing an option of gzip that empties the original file ? Thanks :)
Solved by sending signal to the process (which is a node script) and enforce it to reopen the log file as suggested by AlexP.