[SOLVED] Action to be taken when FS grows fast due to some log files.
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Action to be taken when FS grows fast due to some log files.
What is the best practice when some log files grow very fast and eating away the FS space.
Based on the log file name, in some cases we can use
# cat /dev/null > <logfile> - To initialize to zero.
In this case do I need to refresh the log daemon to start logging in again OR it's starts automatically?
Based on the log file name, in some cases we can use
# cat /dev/null > <logfile> - To initialize to zero.
In this case do I need to refresh the log daemon to start logging in again OR it's starts automatically?
If you're going to do things like this and just delete the log file why are you bothering to log in the first place?
You need a proper log and log rotation strategy, decide how often logs need rotated and how long to keep them and then use logrotate to do the rotation and compression.
What is the best practice when some log files grow very fast and eating away the FS space.
Based on the log file name, in some cases we can use
# cat /dev/null > <logfile> - To initialize to zero.
In this case do I need to refresh the log daemon to start logging in again OR it's starts automatically?
You're not deleting the log file, so there's no need to restart the daemon, but I agree with tentenths totally. If you're not going to READ/examine/use the log file, why have it at all??
I'd examine WHAT you're logging, to what level, and adjust it accordingly. I'd also use something to examine those files for error(s)/message(s) that are important to you, and have it notify you. Logrotate is a good program to use, and you can easily write a program/script to compress huge log files down to a MUCH smaller size.
Don't worry about the contents of log, we normally take a backup OR preserve a copy on some other FS before initializing it. The TB0ne first sentence clarified the doubt.
Don't worry about the contents of log, we normally take a backup OR preserve a copy on some other FS before initializing it. The TB0ne first sentence clarified the doubt.
Thanks,
srao01
Well why not just redirect the log to be sent to that other file system in the first place?
Another issue here is your incomplete question. Using the reveal method to ask your question and then adapt based on others' comments is not the best way to approach things.
logrotate is routinely used to compress log-files and to delete old archives on a rotating basis.
In some situations, e.g. where due to government regulations log-files cannot be destroyed, it is quite common to have "log storage farms," consisting of so-called Network-Attached Storage (NAS) of basically-unlimited size, with daemons that migrate the logs and carefully account for them.
And of course it should go without saying that you should be using LVM = Logical Volume Management to allow any mount-point to spread over multiple physical devices . . .
Last edited by sundialsvcs; 08-19-2016 at 02:59 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.