I have some applications in Linux which create log files of around 41 MB each. The application switches from
log.2 and starts overwriting
log.2 once this 41MB is completed in
I want to take the backup of these files in the way that whenever the new file
log.2 reaches the size more than 1MB it take backup (gzip and store at another location) of other file (
I have been using a script which takes the backup of a file whenever it reaches 41MB but the trouble here is sometimes this 41MB file backup is processed by the script while the data is still getting written to the same file at a huge rate. Because of that some seconds of log data are lost which is the reason I am trying the alternate way of making backup of other file once the new file reaches 1MB or something, so that I am sure that the other file is finished writing.
Any idea how do I do that?