Log Notification script

Hello all,
First off, I’m very new to scripting. I would like to create a script that will help me monitor the logs for one of our applications. Instead of checking the log directory everyday, I would like to be notified if a log file was not created for a particular day. These logs are on a Windows Server 2008 R2. If anyone can provide some info to get me started I would greatly appreciate it

Welcome to the wonderful world of scripting.
If you just need to check for the existence of a file you can use test-path.

 test-path c:\logs\yourfile.log 
This will also work for remote servers if the file is accessible via a share
 test-path \Server\Logs\yourfile.log

There are several specifics you need to determine in order to be successful. Does the file name change? If so, what is the format of the name and does it contain time stamp info that can be used to determine success and\or failure. If not, will checking the file attributes for created and\or modified time stamps be sufficient.
How would you like to me notified? Output to the screen, Log file, email,…etc All are possible.
To get started, If the file name includes the date i.e. c;\logs\yourfile11032015.log you could use
 if(Test-Path c:\logs\yourfile$(get-date -format MMddyyyy).log){
Write-Output “Today’s log was found”
Write-Output “Today’s log was NOT found!!!”

Thank you! I believe this will help me out a lot. There’s no timestamp. The file names come in this format: 66d39c25-9cdd-41a2-84c5-9dc621016bd9.log. So each file name is different. Also, I would like to be notified by e-mail.

You could do something like this


Btw. Script is untested

Ahhhhhh, thank you all. This helps me out so much.