Removing log files to increase disk space

Issue: The user is reporting that one of their instances is running out of space, and they are asking how to clear some space.

Environment: All

Root cause: A log is growing due to some application which is writing several entries into it.


  1. First, you need to find the File System which is getting full, you can do this by running the command: df -h or df -hP
  2. Then you have to look for the biggest files, this can be done by running one of these commands:
    • du -sch * (Additionally, you can pipe a grep to look for the GB files: du -sch *|grep Gb )
    • du --max-depth=1 -h
    • find /file/system -type f -exec du -sh {} + | sort -rh | head -n 10
    • *The above commands are only some examples, you can use one of those or if you have some other, please feel free to use it.
  3. Once we have narrowed down the biggest files(s), and it happens to be a log (It ends in .log) the very first thing to do is to ask the client if they need that log, if they don't then we need to clean it out (It is not recommended to delete it with the command rm, because we are not sure if the application would create the log or not again), you can perform the clean with one of the following commands:

Content Author: Fredy Hortua‍



Please sign in to leave a comment.