Solved

SolarWinds - How to verify file has been created on daily bases..

Posted on 2016-09-18
5
20 Views
Last Modified: 2016-10-08
Greeting Experts,

I am in need of some help... I use a script to create a log file every 24 hrs from Network Security device on our network. The script work w/o any problem but I need to verify the file has been created base on our security policy.  My organization uses Solar Winds Log&Event Manger as part of data management  program... I would like to use to monitor the script by verifying  the zip file has been created.. I.e.  by getting an email tell me the size of the file.. something to the effect of file size less than 0 kb....  can someone direct me in the right direction.
0
Comment
Question by:amstoots
  • 3
5 Comments
 
LVL 17

Assisted Solution

by:lruiz52
lruiz52 earned 100 total points (awarded by participants)
ID: 41804115
You can accomplish what you need with powershell, I had to do some think similar and used the template found in the link below to help with my script.

http://salvoz.com/blog/2012/03/28/powershell-check-for-existence-of-file-and-send-email-if-file-does-not-exist/
0
 
LVL 61

Assisted Solution

by:btan
btan earned 400 total points (awarded by participants)
ID: 41804312
You may want to check the log parser (though it stated for SAM)

The Log Parser template -allows you to check a specified log file and determine the total number of lines that match your search criteria
https://thwack.solarwinds.com/docs/DOC-146181

Find a string in a logfile and count matches (Powershell) - A powershell application will find any matching text in the specified file and report back how many matches it found
https://thwack.solarwinds.com/docs/DOC-189371

Find a string in a logfile using a counter file - This script uses a counter to determine if there are more matches on the current poll than there were on the last poll. If there's more errors on the current poll it will return a DOWN status.
https://thwack.solarwinds.com/docs/DOC-189457

The script will probably will need to work on further on tuning to you need, thereafter just need to create an alert that will look for the status of the component and send an email if the alert is triggered.

Hope this helps
0
 

Author Comment

by:amstoots
ID: 41805750
The name of the file changes everyday with the following  "%Day%Month%Year%ngx.zip (i.e. 19092016ngz.zip)... Is there a way to change over the powershell script to incorporate this
0
 
LVL 61

Accepted Solution

by:
btan earned 400 total points (awarded by participants)
ID: 41805753
The last link in earlier has search string of regex

$filepath = "D:\temp\Sample_Log.log" #this is the file to be searched for matches
$countfile = "D:\Temp\countfile.txt" #this is the temp file that will store your count so you can compare the new count to it
$regex = "INFO: Job started:" #this is the string you're looking for

# Pull in the old count number from $countfile
$old_count = Get-Content $countfile

# Search the flipped file for the string listed in the $regex variable
$find_matches = Get-Content $filepath | Select-String -pattern $regex

Open in new window

you will probably have to adjust the file path referring to regex type or enumerate base on current date..
0
 
LVL 61

Expert Comment

by:btan
ID: 41834900
As suggested in use of Powershell scripts.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

As companies replace their old PBX phone systems with Unified IP Communications, many are finding out that legacy applications such as fax do not work well with VoIP. Fortunately, Cloud Faxing provides a cost-effective alternative that works over an…
When it comes to security, there are always trade-offs between security and convenience/ease of administration. This article examines some of the main pros and cons of using key authentication vs password authentication for hosting an SFTP server.
Viewers will learn how to connect to a wireless network using the network security key. They will also learn how to access the IP address and DNS server for connections that must be done manually. After setting up a router, find the network security…
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now