Jump to content


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.

Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.


Looking for an application that searches in a file and emails based on finding

  • Please log in to reply
1 reply to this topic

#1 doug123x


  • Members
  • 2 posts
  • Local time:04:12 AM

Posted 22 November 2015 - 12:49 PM

HI There,


I'm looking for a simple windows service that I can schedule to run that will do the following:


1.  Search a .log file for a given phrase - "fail" for example.

2.  If this is found, send an email and alert (screen popup) to the administrators.


I may need to resort to a batch file do this, but I hope was hoping something already existed and I could have this up and running very quickly.


Please let me know if you know of anything that fits the bill.



Edited by doug123x, 22 November 2015 - 12:53 PM.

BC AdBot (Login to Remove)


#2 britechguy


    Been there, done that, got the T-shirt

  • Moderator
  • 9,294 posts
  • Gender:Male
  • Location:Staunton, VA
  • Local time:04:12 AM

Posted 23 November 2015 - 11:06 AM

This is a simple batch file if you have an e-mailer that lets you send from the command line.  I haven't tried this in ages on Windows, so I don't know which one(s) might be available.


You should take a look at the post, How to create a command-line toolkit for Windowson these very forums, paying special attention to the "grep" command that's part of UnixUtils.  Grep allows you to do the kind of search for text content you're seeking with ease.  You can then either query the status code returned after the command or redirect the output of the command to a file, and check that its size is not 0 bytes, to determine whether it found what you're looking for.  A simple 'if' construction afterward to trigger the e-mail to be sent and you're done.


You may prefer to go with installing Cygwin rather than the UnixUtils if you want something more current and want to have a more extensive set of Unix commands available to you under Windows.

Edited by britechguy, 23 November 2015 - 11:24 AM.

Brian  AKA  Bri the Tech Guy (website in my user profile) - Windows 10 Home, 64-Bit, Version 1809, Build 17763 

     Presenting the willfully ignorant with facts is the very definition of casting pearls before swine.

             ~ Brian Vogel






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users