Track Twitter World Cup Sentiment with Splunk

As a new product manager here at Splunk, I felt compelled to get my hands dirty and build an app of my own. I had trouble deciding what to build, but after witnessing the World Cup mania and demonstrations of team pride at Splunk’s headquarters I through that somehow capturing World Cup team sentiment might be a fun exercise.

I first armed myself with a Python scripted input made by a fellow Splunker that samples the Twitter updates via the Twitter Streaming API. The sampling algorithm is deterministic, meaning that all users have access to the same subset of tweets and that it is not possible to reconstruct the entire tweetstream. However, the results that Twitter returns are filtered for quality and relevance and should suffice for this particular use case. Twitter requires valid login credentials in order to sample the stream so if you download the app, be sure to open and enter your own credentials between the quotations.

stream = tweetstream.TrackStream(user=" ", password=" ", keywords=["#worldcup"])

The #worldcup hashtag simply indicates that I am only interested in tweets that have something to do with the World Cup. After indexing the tweets, I can extract and count references to team names in order to generate charts like the one shown here.

This graph shows tweets by team. If you’re feeling adventurous, you can edit the inline search to execute in real time over a smaller time window.

You can download this app from Splunkbase. It comes with a dashboard that includes charts like the one shown above as well as a search view that you can use to explore on your own.

As a Senior Product Manager Splunk, I’ll be helping drive the core product strategy, with a particular emphasis on search and the user interface and welcome your input and feedback.

Fun and easy. That’s the nature of Splunk. And if you’d like to learn a bit more about developing on or with Splunk, or just the types of data you can visualize, swing by our booth at the Velocity Conference in Santa Clara this week in booth #205. Even better, join us for our first Users’ Conference. Register by Friday to save $100.

Posted by