0

I am a Java developer. I have been a Linux user for a few years, due to this fact, I was asked to clean up and analyze the disk space of one of our servers. I came across an 81Gb file called Openswan.log I would like to clean it, but I have no idea how to do it safely. Due to the size of the file, I have difficulties accessing it and deleting the oldest records.

I would like suggestion to solve this problem.

1 Answer 1

1

You need to first find out if company policy requires to preserve the log file for auditing purposes. Depending on that, you can either remove the file or archive it.

If it is free to delete, you can remove the file by running rm Openswan.log. After that, you need to restart the Openswan daemon. You need to look into your distribution's service management tools to find out how to do it.

Without restarting the daemon, the disk space is still used.

If the file needs to be preserved for audit purposes, you can run mv Openswan.log Openswan.log.1 and then restart the daemon. After that you can copy the log file to another place, or compress it.

To prevent log files filling up the disk space, one should configure appropriate log rotation, where logrotate utility is used to rotate log files on specific criteria. Here, the criteria are defined by your company's policy on auditing.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .