Cisco CDR
Imagine plotting your printer error count directly on a floorplan, or dropping count of failed backups on a campus map so you know which locations are having problems!
If you were to search for “Splunk custom map”, you might find as I have that the only customizations they talk about involve just putting *your* data on *existing* maps.
While this is useful, sometimes you need your own image used as a map. While looking, I found a couple of almost-solutions but nothing that solved the whole problem. It turns out that a large portion of this problem isn’t a “Splunk” problem, but will involve other products to build the maps themselves, so I decided to write this quick tutorial on how to build a map.
Having visited Washington D.C. a short time ago (for Splunk .conf 2018), I decided to try to make my own map out of an image I found on the internet of the national mall. I wanted this to consist of my own custom “map” that I could place in a dashboard in Splunk, and have data be populated into it just like any other map. The techniques here should apply to anything from a campus map to a floorplan.
The steps involved are (Current Step Highlighted below)
I won’t belabor this with great detail, but you need to in your Splunk install the app Shapester. Steps may vary, but here’s a set that should work.
Note – if you are just here to build a Choropleth map on top of any of the existing tilesets (see below), then you don’t need to add your custom tileset in. You can instead just … build it on top of the tilesets that already exist inside Shapester.
But, if you are here in a continuation of our series …
If you change to the app Shapester, you’ll see a map of the world. In the upper right there is a “tileset” loader “button”.
When you click it, the following menu appears.
While that menu includes some great tiles, it doesn’t include yours so we’ll have to add it.
This will involve editing a little bit of javascript, but as you’ll see it’s not real hard. The hardest part is finding the right place to make the change!
{ "attribution": "My Amazing Self, Rich Mahlerwein. Also the image started from a freely usable one.", "name": "National Mall", "url": "/static/app/maptest/national_mall/{z}/{x}/{y}.png" }
Now that we have our map showing up so we can edit it, let’s make some shapes on it!
(If you were just using a built in map, then I guess the above statement still applies to you too!)
Using the toolbar on the left, I’m going to draw a square on top of the White House. So,
That should be it for this part! Next step is to change permissions so that we can use this lookup in another app.
First, we need to make the lookup we just created available to our own app. There are many ways to do this, the two I’d recommend is either changing permissions on the lookup so it’s available everywhere, an exercise I document below, or you can just clone it from the shapester app into your own, an exercise will leave to the reader if you wanted to do this instead.
Note we have to make this change in two closely related places, so if the directions feel like they’re nearly repeating themselves, it’s because they are.
Now this lookup will be available in all apps on your Splunk server.
Now for the exciting part!
Change back to your own app where your map exists.
For the continuation of this example, I’m going to start with my search from the previous posts which uses makeresults to fake up a single event. In your case, use a search that returns those locations.
| makeresults | eval myLocation="Smithsonian Air and Space Museum"
That returns a single event with a _time of now and myLocation set to the Air and Space Museum. Your search will be different (though you can use this technique for testing), and it should return data with items like what you named your map sections. For this particular case, we’ll also eval a count field, which is the hard-coded “what values encode the color of the choropleth map” field. You’ll see that below in my examples.
For Choropleth maps, the “lookup” portion is done with the geom command. There’s some great documentation and examples on Splunk’s page for geom, so if you get stuck or want more information I suggest checking that out.
For our needs, we’re going to need to tell the geom command what the featureId field is in our data. This is so that it knows what field in OUR data maps to the field the map uses.
| makeresults | eval myLocation="Smithsonian Air and Space Museum" | eval count=1000 | geom geo_national_mall featureIdField=myLocation allFeatures=true
Now, switch to the tab Statistics and confirm you see geom data – this is our test that the lookups we created are correct.
Now, an “almost-repeat” of the steps from previous posts to change to a Choropleth map, and change the tileset to our own.
And that’s it! While not amazing in MY test case, you can see how both show up. From here, there are all sorts of settings you can play with to change colors, ranges,
I know this has been a rather long road, but I’m glad you stuck with me until the end.
I’ve love feedback on this process, or to see any of you own maps you’ve come up with!
Send ’em in to mapping@sideviewapps.com
Great software ultimately has to empower you to achieve more in less time. This extends to the company behind it -- we have to remember to always use your time as efficiently as we can.
And here I am happy to say that we shortened our Product Overview video dramatically. The new one is only 4 minutes long, vs 11 for the old one. You can see it here:
NOTE: the old one showed more of the product and was definitely more complete. In fact this was deliberate because we used it both for new users and also to be a deeper onboarding video for everyday users. However it was a bit too long for anyone who just wanted the short version and didnt want to spend 11 minutes of their day.