Delete System Log Files Safely

What is a System Log File?

A Log File (.log) contains the details of events that occurred while executing a program.

It is a way of collecting data that helps software developers and computer experts identify runtime issues, such as a computer crash, system reboot, blue screen of death, or an error message. Typically, most software architecture makes use of a logging system to generate, filter, encode and record application log messages.

 

What is An Event Viewer?

Event Viewer is a part of Microsoft Management Console (MMC). It is primarily used to view system logs, which are system files that contain information useful for system diagnostic and troubleshooting purposes. It displays information in an easy to comprehend manner using console trees. You can view the information and even save a copy of it. You can even sweep clean system logs to recover disk space if required.

 

Types of Events

Log files are further classified into the following categories:

  • Custom Views: It is a filter that includes events from event logs according to the specified criteria.
  • Windows Logs: These log files contain details on just about any kind of the most frequently occurring events that take place including boot time logs, security logs, setup logs, system logs etc.
  • Applications and Services Logs: This includes logs stored by individual applications – both Microsoft and Non-Microsoft, as well as various services and processes that run in the background.
  • Subscriptions: This includes source-initiated event subscriptions and collector-initiated subscriptions that are collected from multiple event source computers by a single collector computer.

 

Clearing the Event Log

Using Event Viewer

  1. In the Search Box on the Taskbar, type Event Viewer.
  2. Open the Event Viewer from the Search Results.
  3. Expand the top-most nodes; navigate to the event log you want to clear using the console tree on the left.
  4. Click the Action menu.
  5. Select Clear Log.
  6. Click the Clear button in the subsequent dialog box.

Note:

  • You may, alternatively, select a log item, and click the Clear Log option on the Actions panel on the right-hand side.
  • If you want to save the event logs before cleaning, use the Save and Clean option in step # 6 above.

 

Deleting Console Files Saved in your Profile

  1. In the Event Viewer window, click the File menu in the menu bar.
  2. Select Options.
  3. Click the Disk CleanUp tab in the Options dialog.
  4. In this dialog, you can see the amount of disk space used by saved files in your profile.
  5. Click the DeleteFiles button to delete the files.
  6. To exit, click OK.

Using Command Prompt

  1. Press Windows Key + X.
  2. Select Command Prompt option.
  3. In the CMD window, type the following command and press Enter:
    for /F “tokens=*” %1 in (‘wevtutil.exe el’) DO wevtutil.exe cl “%1”
  4. After finishing up quit the window.

Using Windows PowerShell

  1. Type Windows PowerShell in the Search Box on the Taskbar.
  2. Open the Windows PowerShell program from the Search Results.
  3. In the newly open screen, execute the following command:
    Get-EventLog -LogName * | ForEach { Clear-EventLog $_.Log }

Using Windows Disk Clean-Up

  1. Double-click This PC icon on the Desktop.
  2. Right-click the drive which contains Windows and other installed applications.
  3. Select Properties.
  4. It opens up the Drive Properties dialog.
  5. Click the Disk CleanUp button in the General tab.
  6. Let Disk CleanUp calculate the total volume of temporary files that can be cleaned up.
  7. Thereafter, select all the items including the following one:
    System archived Windows error reporting
  8. Click the OK button.