-3

I need your help, I currently have a full disk.

It happens that I just checked in my ssh

cd/var/log/nginx/

he says ls (He gave me these results)

access.log domain.acc.log error.log domain.err.log

Then ls -lh (I showed this result)

-rw-r-r-- 1 root root 0 access.log
-rw-r-r-- 1 root root 3.6K error.log
-rw-r-r-- 1 root root 27G domain.acc.log
-rw-r-r-- 1 root root 7.5M domain.err.log

This is where I realized that the part of -rw-r-r-- 1 root root 27G domain.acc.log, has 27 gb?

I would like to eliminate this. could someone help me how to do it? without making a mistake? I use linux

1
  • This question would be more suitable for superuser.com
    – jrswgtr
    Commented Nov 9, 2019 at 10:08

1 Answer 1

-1

welcome to Stack Overflow!

This question likely belongs to another community, such as Server Fault and may be migrated.

However, you can empty the domain.acc.log while the process is running (assuming that you don't need to keep the data) by running the command echo "" > /var/log/nginx/domain.acc.log.

To break down what you are doing, the echo "" means you are outputting an empty string, then > takes the input and writes it to a file, overwriting any content in the file.

This is the safest way to empty the log as other processes can continue to write to the file without releasing their file descriptors, and you can be sure that the underlying data is removed even if the path (/var/log/nginx/domain.acc.log) is just a link to the file

Not the answer you're looking for? Browse other questions tagged or ask your own question.