I have a bunch of software tools that are installed on 50-100 Windows 7 user PCs. These tools currently all log warning, error and information messages to a tools.log file on each PC. When I want to look at what has been going on a particular PC I need to get their log file. I’d prefer to store all users’ log data in a central database so that I can perform useful queries on it. I’d also like to be alerted to certain calamitous situations (e.g. using a database ‘on insert’ trigger to check for certain situations).
The software tools that write to the log are Windows Batch files and C++ or C# apps. I need an API and a little command-line tool so that I can write direct to the log in two ways: from an app using the API or piped to the log using standard Batch file syntax like
echo Something bad happened | log_tool
My question is: what is a simple way to do this that won’t cause major slowdown when I need to echo lots of commands to the log in rapid succession? For example, if each pipe causes a database transaction, it’s too slow.
Are there any existing pieces of software that might help me here? (Like, say, a memcached-backed-by-a-shared-database type of thing?)
This may not be an exact answer, but the windows event log is designed to do exactly what (I think) you want to do.
You can write to the event log from a batch file by invoking logevent.exe (you may need to install this first).
You can use one of the many logging frameworks in .Net to write to the event log (log4Net is my favourite).
The event log is designed to be reasonably performant; log4Net allows you to batch logs if you’re going for very high volumes.
The event log is accessible across the network, and there are lots of tools available for monitoring those logs, with corresponding workflows (Nagios, BigBrother, MS MOM).