Backing Up and Centralizing IIS Log Files

Backing Up and Centralizing IIS Log Files

March 2nd, 2021

Hello this is Mike Janulaitis founder of Corner Bowl Software. In this article I am going to show you how to backup IIS log files to a central location while also deleting old log files that are no longer needed with Corner Bowl Event Log Manager 2021.

How to

To accomplish this task, we must create and assign a new Text Log Backup Template.

  1. Select File -> New. Expand Template, then Log Management then click Log Backup.
  2. From the New Template view, find the Sub-Type drop-down then select Text Log.
  3. From the General tab specify a friendly name such as Backup IIS Log Files.
  4. Since IIS generates a log per day by default, the default schedule of Daily is appropriate.
    General options for backing up and centralizing IIS log file
    General options for backing up and centralizing IIS log file
  5. Select the Logs tab then navigate to the latest log file.
  6. Once selected, modify the Search Criteria to specify the current date. For example:
    D:\Web_Logs\WebSite01\W3SVC8\u_ex<yyMMdd>.log
  7. If I click the Test Check Button button we can see the current file.
    Assign IIS log files to backup and centralize
    Assign IIS log files to backup and centralize
  8. Click the Add Add Button button.
  9. Next click the Options tab.
  10. Use the Filename text box to specify the central location to save the log files. Notice the use of TAGS {HOST} {LOG} {DATE} and {TIME}. Since IIS log files have the date embedded in the file name, there is no need to use the DATE and TIME tags. If I change the output to: 'D:\Web_Logs\Backup\{HOST}\{LOG}' a directory will be created for each host I assign this template too. The {LOG} tag tells the software to backup the IIS log file with the same filename.
  11. If I choose to compress to ZIP, the IIS log file is compressed to the same filename but with the .zip extension in place of the .log extension.
  12. If you like you have the option to encrypt and digitally sign the files.
  13. Next we have the option to delete the file that was backed up. I want to leave 15 days of logs on the server so I'm going to leave this option off.
  14. Next I would like to only leave 15 days of log entries on the web server so I'm going to check the 'Delete files in the source directory' option then set the number of days to 15.
  15. Next I am going to choose to only retain 90 days of logs in the central location so I'm going to check the 'Delete files in the destination directory' option then set the number of days to 90.
  16. Finally, I need to tell the software to backup the previous day's log rather than the current log because it is still being populated with current events. To do this I need to check the 'Backup yesterday's file or path' option.
  17. Once I have completed the configuration, I must still assign each server which I would like to backup the IIS log files from. Since I only selected a file from my localhost we can see the local host is already assigned in the assigned Hosts list. Use the hosts drop-down to assign other servers.
    IIS log file backup options
    IIS log file backup options screenshot
  18. Click Close and save your changes.
  19. Next I want to show you this in action so I'm going to manually execute this template on my localhost.
  20. From the Explorer view navigate to the target host, expand, find the new template, right click and select Execute Verbose.
  21. The Host Template Status view displays and we can see the results.
  22. Once complete we can see many old files that were deleted from the source server.
  23. Once this template runs for more than 90 days, old files will be deleted from the central IIS log repository.
  24. If I open Windows Explorer we can see the backed up file compressed in ZIP format.

That's IIS log file backup and centralization with Corner Bowl Event Log Manager.

Last Updated: March, 3rd 2024