I have some applications in Lunux which creates Log files of around 41 MB each. The log files switches from log.1 to log.2 and starts overwriting log.2 once this 41MB is completed in log.1 file.
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 (log.1).
I have been using a script which takes the backup of file whenever it reaches 41MB but the trouble here is sometimes this 41MB file backup is take by script, still the data is getting written on the same file at a very huge rate because of which it loses some seconds of log data 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?
rsyslogto log over the network to a remote machine? You can than take backups/snapshots over there and control the rotation of the files without disturbing this machine. – gertvdijk Dec 27 '12 at 11:23