How To Clean Logs

Table of contents:

How To Clean Logs
How To Clean Logs

Video: How To Clean Logs

Video: How To Clean Logs
Video: How to clean mold off your logs or boards 2024, March
Anonim

Today, operating systems include special services, using which application and system programs can save data about their work in special logs. Such logs are called logs. For security reasons or for reasons of saving disk space, it is sometimes necessary to clean up the logs.

How to clean logs
How to clean logs

It is necessary

administrator or root rights on the local machine

Instructions

Step 1

Select the Windows log partition to be cleaned. Click on the "My Computer" icon on the desktop and select "Manage …" from the context menu. Or activate the "Computer Management" shortcut located in the "Administrative Tools" folder (you can go to it from the "Control Panel" window, which is opened using the corresponding item in the "Settings" section of the "Start" menu). The MMC console will start.

In the Computer Management (Local) tree, expand Utilities and Event Viewer. Highlight nested items and view the logs. Determine which partitions you need to clean up.

How to clean logs
How to clean logs

Step 2

Clean Windows logs. Highlight one of the items in the Event Viewer category selected in the first step. To do this, click on it with the left mouse button. Expand the "Action" section of the main application menu or open the context menu of an element by right-clicking on it. Select "Erase All Events". You will be prompted to pre-save the deleted data. If necessary, click Yes and save the events to an external log file. Then the logs will be cleared.

How to clean logs
How to clean logs

Step 3

On Linux or FreeBSD operating systems, find the log files maintained by the syslogd service that you want to delete. Open the /etc/syslog.conf file. Review it. Get the paths to the log files of the required subsystems or applications.

How to clean logs
How to clean logs

Step 4

Stop the syslogd service. Start a root user session. To do this, switch to a text console or start a terminal emulator. Log in with root credentials or start a session with su. Run the command in the console:

service syslogd stop

Wait for the service to stop.

How to clean logs
How to clean logs

Step 5

Clean up the logs. Use the redirection command to overwrite the contents of the log files found in the third step with data of zero length. For example, to clear the / var / log / syslog / messages file, run the command:

/ var / log / syslog / messages

Start the syslogd service with the command:

service syslogd start

Wait for the service to finish starting.

Recommended: