Schedule a Task to Cleanup a Log Folder

Introduction

Have you been alerted about a drive filling up over the weekend during your monthly patching schedule? What a bad moment to get a warning like this and have to deal with before the server locks up by Monday morning. Expanding a drive can be your first reaction, but after it fills up again a few months later you dive into it by analyzing disk space only to find it’s a pesky Log folder filling up for years now. Say no more, let’s schedule a task to cleanup a log folder!

How To Schedule a Task

Here is some light reading on using forfiles – a way to select and execute a command on a file or set of files. We are going to use it to clean up a folder on a Network Policy Server.

  1. Open Task Scheduler – Create a basic task
  2. Give it a Name and Description
  3. Trigger – how ever often you would like to clean it up
  4. Action – Start a program. These are the specific details I have used:
    Program/script: Forfiles.exe
    Add arguments: /p C:\Windows\System32\LogFiles\NPSLogs /m *.log /d -30 /c “Cmd.exe /c del @file”
    Start in: C:\Windows\System32
  5. Once complete Run Now to see if it works – backup the folder first!

Tips

Here are a few more thoughts to keep in mind:

  • If you are concerned about the data be sure to copy the entire log folder somewhere else while you test out this process.
  • Run the task as a local Admin account or a service account where the password won’t change. Otherwise the script will stop running after you change your password.
  • You can delete more than just log files, look above in the argument for the *.log parameter for file type. You can change this up to a different file type if your software uses a different kind.

Conclusion

Hope this helps you schedule a task to cleanup a log folder. I’ve found it’s better to be proactive about this, before you know it years have passed since you setup the server and you wished you would have taken the 15 minutes to have a scheduled task. See more posts about IT Operations here.

Push Notifications For RSS Feeds with iOS

Background

In the growing age of Software as a Service (SaaS) applications it’s critical to monitor outages and service degradation. Most SaaS companies have a status page you can check, some offer ways to sign up for alerts to email or txt messages. Personally, I prefer RSS feed because I can centralize all my feeds into one place. Let’s take a look at a way to get push notifications for RSS feeds.

Feedly and IFTTT

When Google Reader met it’s demise I searched around for a few different RSS apps and came across Feedly. I’ve been hooked ever since! Along with Feedly is an automation service IFTTT – short for If This Then That. It’s a great way to automate actions between account services.

Setup

  1. In order to do everything below you will want to create accounts in both Feedly and IFTTT.
  2. In Feedly you will want to “Create a new Feed” and call it something like RSS Notifications. This will act as a category to subscribe to all your RSS feeds.
  3. Now go to “Add Content” and paste in the URL for the RSS feed you want to subscribe to. Add to your RSS Notifications feed category. For example: https://status.slack.com/
  4. After adding the RSS feeds you want let’s go to IFTTT, there is a specific applet already created you can use called Feedly iOS Push Notifications – connect this to the Feedly category you created and you should be good to go!

Summary

I hope these push notifications for RSS feeds help you stay on top of the services you have and know when to inform others that they should expect possible issues. Communication is key for any team or business!