As I’ve blogged previously, I use a Raspberry Pi to collect data on passing commercial aircraft, and recently I got the same data into Splunk and started dashboarding with it. So far, so good. However, I felt that the data presented in Splunk wasn’t quite as rich as I’d like it to be. Sure, it told me things like speed, altitude, callsign etc… but I didn’t know much about the aircraft itself, where had it come from, where was it going, and for some of the more obscure airline codes, which actual airline was it? I knew that Splunk could enrich its data by using lookup files, but to manually create a lookup file for all of the flights that pass overhead would literally take days if not weeks to complete. That was out of the question. So then I turned to what every lazy amateur coder does: write a script to do it for me.
Introducing: Stunning Chainsaw – a Python script that will take a list of flight numbers from you in CSV format, and then go away out on to the internets and extract relevant and useful human readable information about the flight, and then write all of that information into a csv file formatted perfectly to be a lookup file in Splunk.
It took a little bit of playing around to get to work, especially when I forgot (was too lazy) to put in error checking initially. The script would throw an AttributeError if the regex failed to populate a capture group, so that needed to be ironed out. However, now it works perfectly, and is creating me a great bit lookup file to enrich my radar data dashboard. Much pleased with myself. 🙂