Just trying to clear out my storage on my system drive and was curious:
is it safe to delete everything in /var/log?
You will lose log messages.
I sometime do:
rm /var/log/*.xz
which removes the older logs but keeps the recent ones.
So its safe but i just lose old/current logs?
If you have logs growing at such a rate that you care, you probably should look into that.
If you still use YAST, do not delete the YaST2 folder in var/log. Also the journal folder should not be deleted.
What happens if you do?
You got a serious advice. Would you also like to know what happens if you … <not_saying_here>? Your logs rotate i.e. grow to a max, when max is reached older logs get deleted.
I’ve done this many moons ago just to see what happens! ![]()
It did not end well, there are directories with their own owner/group perms in there and the system breaks, or is not in a good state IIRC.
Some software will not work if even their logfile is deleted. You can empty it > /var/big_log but delete it and the software goes ![]()
As @nrickert says, it should be fairly benign to delete the compressed archives in there! ![]()
For full system snapshots/backups, I now include /var as well. Sigh! ![]()
Yast modules will no longer open if you delete var/log/YaST2, if you delete the journal folder, it will remain empty and you can’t get any messages from it. Other folders like zypp, cups and audit will be recreated. If you are annoyed by the logs you can edit the behaviour in /etc, but only do it if you know what you do. Imho it is not worth it to play around with that, the potential issues you can create are more problematic than some log files.
Was just curious because I have a computer from a friend who did that and he said he was having issues so I was trying to figure out more. Now that you mention it, how exactly does one fully recover from such a thing? (IT stinks sometimes)
You can just recreate those folders, just make sure the naming is right, e.g. YaST2.
Generic reply: In case of trouble it is nice to have some logs.
And how does one know what to recreate?
and permissions, and security labels …
Well, if you’ve already done that and you need to recover your system, the first step is to go to your backup, made just before you made any catastrophic changes and restore the entire log folder with sub trees, all permissions and content intact. Of course that doesn’t apply if you don’t have a backup, but brings up the question of why you don’t have backups. Because if you’re going to mess around with removing files the system uses then you kind of better have good backups first in duplicate on different media, verified.
I’m not OP so I am not sure why you reply to me.
Soooo…. What if this isn’t my system and I dont know what folders existed previously, say the system has been operating like this for a while (at least this is what I was told).
Lets clarify some points:
Why do you want to delete all the content of /var/log?
Which size does the directory occupy on this system?
Does it have negative effects on your system to keep these logs?
My apologies, im replying via email so I dont exactly the system ruled out for myself yet. ![]()
Run the system and let us know what problems you have. I hinted two consequences when you delete everything in var/log/. I have no idea what software is installed on that system and could be effected by this.
Well, the original reason was that mine are at least 10 GiB and journal logs are most of it, and the only reason I checked was, again, because I was fixing someone else’s system.