0

I noticed that my disk in my Linux ubuntu server is already full and one that's causing it is inside my /var/log folder.

I have these files inside my /var/log:

enter image description here

I don't know what files are these, but are these safe to delete?

There's a bunch of alternatives.log.x and other .gz files. Can i delete those?

Thanks.

  • 5
    You're trying to fix the symptom of a problem, rather than the real issue. The logs will fill again, so why not look at what's in the logs first to see what's filling your logs. – guiverc May 17 '20 at 01:13
  • 1
    yup, I agree with that and I can do that later but is it safe to delete these files? – PinoyStackOverflower May 17 '20 at 01:14
  • Can you at least post samples (add to your question, please) of the current logs that are causing the most problems? – ajgringo619 May 17 '20 at 01:16
  • You're not listening to @guiverc advice. Figure out which log is taking up the space, then review the log to find out what's filling the log, then fix that first. In terminal type cd /var/log then ls -alS and look at the first 1-5 lines of output to see the top file sizes. Then tail filename. So NO, don't delete anything. – heynnema May 17 '20 at 13:31
  • 1
    Agree that you need to figure out what is going on to create such big logs in the first place. Disagree that you shouldn't delete something in the meantime. If your disk is full, then the priority is to make a bit of room, then investigate. Delete the oldest files first. if this is a server, some services might no longer work properly (I recently filled by server disk by accident, and only noticed days later that a service (DHCPD) was no longer working properly). The answer to your question is, yes. – Doug Smythies May 17 '20 at 14:31
  • sorry boss @heynnema for not listening! I already followed guiverc advise, i just didn't came back here because it was Sunday yesterday, so you better edit your comment and remove that judgement of yours. I agree with Doug that the priority first is to delete old files first because investigating, because how can I investigate if my server is full and there are already live users, so i need a band aid solution first then investigate. – PinoyStackOverflower May 18 '20 at 01:46
  • The oldest files may not be the culprit. It's usually the log file that is written to most recently, and that's why I gave you the ls -alS command, and instructions on what to do next. As any forensic detective will tell you, don't delete evidence without looking at it first. – heynnema May 18 '20 at 01:53
  • @DougSmythies re: "Delete the oldest files first."... the oldest files may not be the culprit. It's usually the log file that is written to most recently. As any forensic detective will tell you, don't delete evidence without looking at it first. – heynnema May 18 '20 at 01:56

0 Answers0