How to automate archiving of log files using tar?
i would need help ,
i need to tar this logs, but i dont how to make it simplier to me. Everyday there are created this five logs. I need to make five tar files from every day from this files at the end of the month for example wlp-process_dump.log.tar.gz ( will contain every wlp-process_dump.log from this month ) wlp-cxf.log.tar.gz wlp-jamon.log.tar.gz wlp-refresher.log.tar.gz wlp.log.tar.gz 33819 Mar 21 19:20 wlp-process_dump.log.2011-03-21 5144882 Mar 21 23:52 wlp-cxf.log.2011-03-21 1106593 Mar 21 23:59 wlp-jamon.log.2011-03-21 2192832 Mar 21 23:59 wlp-refresher.log.2011-03-21 2405037 Mar 21 23:59 wlp.log.2011-03-21 till now i have tar it manualy ( copied every file ) Thanks in advance |
How about something like this?
Code:
#!/bin/sh Cheers, Josh |
You could use logrotate to not only rotate new log files eg each day, but to also tar & gzip the old files automatically.
http://linux.die.net/man/8/logrotate |
All times are GMT -5. The time now is 08:50 AM. |