There are a few log files which occupy a huge amount of space and I want to restrict it to 10MB in Linux.
For example: test.log file should not exceed 10MB; logs should stop going to that file.
Can you please share the possible steps or commands to accomplish this?
Best Answer
Inspired by alex's answer to a similar question, if you can control the location of the log file such that it can be placed in a separate directory, then you could create a loop-mount backed by a file of a given size. Writes to that subdirectory will then be limited by the size of the backing file. This would start to get messy if you needed to handle multiple log files.