Zipping log files to save disk space is quite a common task for system admin. Logs can be kept for a certain period of time depending on the company policy. To keep logs files and not delete them is quite a good strategy. If something goes wrong, you will be able to trace and go back in time, and check what went wrong. Zipping log files can be done manually, or via Bash or Shell script. If the folder has a standard pattern, which is quite ideal then creating a shell script to automate the zipping of log files will be easier. For example, if the log files is on this path /mnt/log folder. And it has this pattern, YYYY-MM-DD. Creating a script to avoid manual task can be done easily. Depending on how busy the application is, log files can grow easily and may fill-up the disk quickly. If the log folder structure is based on Year, Month and Date. Then the shell script knows what pattern to look for and the task can be automated. Example Screenshot of the log folder structure: Below is ...
Make the world a better place by sharing knowledge, ideas and anything that you can give that comes from the heart.