IIS Logfile Visualization with XNA
- by BobPalmer
In my office, I have a wall mounted monitor who's whole purpose in life is to display perfmon stats from our various servers. And on a fairly regular basis, I have folks walk by asking what the lines mean.
After providing the requisite explaination about CPU utilization, disk I/O bottlenecks, etc. this is usually followed by some blank stares from the user in question, and a distillation of all of our engineering wizardry down to the phrase 'So when the red line goes up that's bad then?'
This of course would not do. So I talked to my friends and our network admin about an option to show something more eye catching and visual, with which we could catch at a glance a feel for what was up with our site.
He initially pointed me out to a video showing GLTail and Chipmunk done in Ruby. Realizing this was both awesome, and that I needed an excuse to do something in XNA, I decided to knock out a proof of concept for something very similar, but with a few tweaks.
Here's a link to a video of the current prototype:
http://www.youtube.com/watch?v=jM_PWZbtH2I
Essentially this app opens up a log file (even an active one) and begins pulling out the lines of text. (Here's a good Code Project link that covers how to do tail reading from an active text file: http://www.codeproject.com/KB/files/tail.aspx).
As new data is added, a bubble is generated in the application - a GET statement comes from the left, and a POST from the right. I then run it through a series of expression checkers, and based on the kind of statement and the pattern, a bubble of an appropriate color is generated.
For example, if I get a 500, a huge red bubble pops out. Others are based on the part of the system the page is from - i.e. green bubbles are from our claims management subsystem, and blue bubbles are from the pages our scheduling staff use to schedule patients. Others include the purple bubbles for security and login, and yellow bubbles for some miscellaneous pages.
The little grey bubbles represent things like images, JS, CSS, etc - and their small size makes them work like grease to keep the larger page bubbles moving.
The app is also smart enough that if it is starting to bog down with handling the physics and interactions, it will suspend new bubbles until enough have dropped off that performance can resume (you can see this slight stuttering in the sample video).
The net result is that anyone will be able to look up on the wall monitor, and instantly get a quick feel for how things are going on the floor. Website slow? You can get a feel for both volume and utilized modules with one glance. Website crashing? Look for a wall of giant red bubbles. No activity at all? Maybe the site is down. Now couple this with utilization within a farm, and cross referenced with a second app showing the same kind of data from your SQL database...
As for the app itself, it's a windows XNA project with the code in C#.
The physics are handled by the Farseer physicis eingine for XNA (http://www.codeplex.com/FarseerPhysics) which is just pure goodness. The samples are great, and I had the app up and working in two evenings (half of that was fine tuning, and the other was me coding with a kid in my lap).
My next steps include wiring this to SQL (I have some ideas...), and adding a nice configuration module. For example, you could use polygons, etc to tie to your regex - or more entertaining things like having a little human ragdoll to represent a user login.
Once that's wrapped up and I have a chance to complete some hardening, I will be releasing the whole thing into the wild as opensource.
Feel free to ping me if you have any questions!
-Bob