lonestar
lonestar

Reputation: 387

Is it safe to delete /var/log/node.log?

I ran out of space in my ubuntu+vagrant environment, then upon checking those large files, i found out that node.log in /var/log/ uses 7.7G, which is enough space I need.

-rw-r----- 1 syslog adm         4096 Apr  1 15:21 kern.log
-rw-r--r-- 1 root   root       90420 Apr  1 16:54 dpkg.log
-rw-r----- 1 syslog adm        28672 Apr  1 16:59 auth.log
-rw-r----- 1 syslog adm        57344 Apr  1 17:01 mail.log
-rw-r--r-- 1 root   root  8219842764 Apr  1 17:01 node.log
-rw-r----- 1 syslog adm    299622400 Apr  1 17:01 syslog

My question is it fine to delete this file?

Upvotes: 1

Views: 2165

Answers (1)

Dot.
Dot.

Reputation: 208

It is safe to delete a log file. However, it is not safe to delete a log directory. Example of deleting /var/log/mail/ cause a File not found exception when trying to write /var/log/mail/info.log. Because the parent directory can not be found.

Although I advise you to empty it instead. Several other ways to empty a file.

cat /dev/null > /var/log/node.log

Upvotes: 2

Related Questions