Splunk Lab - Creating Maps
Splunk Lab - Creating Maps
Overview
Welcome to the Splunk Education lab environment. These exercises will guide you through the
process of creating a set of dashboards with cluster and choropleth map visualizations. You will
also customize a marker map and make it interactive. Perform all searches and create all
dashboards in the Creating Maps course app.
IMPORTANT: If you copy text from this document, please note that character formatting and artifacts
created by the PDF generation process can cause errors in the dashboard source
code. Consider using a text editor as an interim step.
Typographical Conventions
• Blue text indicates add text
• Red text indicates remove text
• Grey text provides placement information
Source Types
Source types used in these exercises are referred to by the type of data they represent.
Type Index Source Type Interesting Fields
Server access data security linux_secure action, app, dest, process, src_ip,
src_port, user, vendor_action
Retail sales sales vendor_sales AcctID, categoryId, price,
product_name, productId, sale_price,
Vendor, VendorCity, VendorCountry,
VendorID, VendorLatitude,
VendorLongitude, VendorStateProvince
© 2022 Splunk Inc. All rights reserved. Creating Maps January 26, 2022 1
Lab Exercise 1 – Create a Cluster Map
Description
Create a dashboard with a time range input and two visualizations – a line chart and cluster
map. Perform all searches and save the dashboard in the Creating Maps app.
Scenario: The security team wants a dashboard with a map that displays user logins globally. They
supplied a wireframe to use as a guide. The dashboard includes the following:
- Time range input
- Line chart displaying all logins
- Map of logins by location
Wireframe:
© 2022 Splunk Inc. All rights reserved. Creating Maps January 26, 2022 2
Steps
Task 1: Change the account name and time zone.
Set up your lab environment to fit your time zone and the app you will
be working in.
1. Navigate to User Menu > Account Settings.
2. In the Full name box, enter your name: <Firstname Lastname>
For example: Mitch Fleischman
3. Click Save.
4. Navigate to User Menu > Preferences.
5. Enter the following settings:
• Time zone: <your local time zone>
• Default application: Creating Maps
6. Click Apply.
7. Navigate to Apps > Creating Maps.
TIP: Since your default application is now Creating Maps, clicking the Splunk logo in the upper left is
the same as navigating to Apps > Creating Maps.
© 2022 Splunk Inc. All rights reserved. Creating Maps January 26, 2022 3
Task 3: Add a time input.
12. Click +Add Input and select Time.
13. Click the pencil icon on the input.
14. Use the following settings:
General
• Label: leave blank
• Search on Change:
Token Options
• Token: timeTok
• Default: Last 7 days
15. Click Apply.
Example:
© 2022 Splunk Inc. All rights reserved. Creating Maps January 26, 2022 4
25. Enter a stem search for all password events over the last 7 days.
index=security sourcetype=linux_secure src_ip="*" action=*
26. Pipe to the iplocation command to extract location information from IP addresses.
index=security sourcetype=linux_secure src_ip="*" action="*"
| iplocation src_ip
Example:
© 2022 Splunk Inc. All rights reserved. Creating Maps January 26, 2022 5
Lab Exercise 2 – Create a Choropleth Map
Description
Create a geospatial lookup and use it to generate a choropleth map. Perform all searches and create all
knowledge objects in the Creating Maps course app. An optional challenge lab exercise is to create a
choropleth map using Dashboard Studio.
Scenario: The sales services team wants a dashboard with a map that displays retail sales in Canada
by province. They have supplied a wireframe they to use as a guide. The dashboard
includes the following:
- Time range input
- Geospatial lookup
- Map of Canada
Wireframe:
© 2022 Splunk Inc. All rights reserved. Creating Maps January 26, 2022 6
Steps
Task 1: Create a geospatial lookup.
NOTE: The Download link goes to a zip file, splunk_course_files.zip, which contains the canada.kml
file. Double-click the splunk_course_files.zip file to make its files available for upload.
NOTE: Depending on your network speed, uploading the file may take a few minutes.
© 2022 Splunk Inc. All rights reserved. Creating Maps January 26, 2022 7
Task 2: Test the lookup.
15. Click Search.
16. Use the inputlookup command to search the content of the lookup.
| inputlookup canada
Example:
Example:
© 2022 Splunk Inc. All rights reserved. Creating Maps January 26, 2022 8
22. Use the geom command to map VendorStateProvince to the canada lookup file.
index=sales sourcetype=vendor_sales VendorCountry=Canada
| stats sum(price) as USDollars by VendorStateProvince
| eval CDNDollars = round(USDollars*1.31,2)
| fields - USDollars
| geom canada featureIdField=VendorStateProvince
Example:
Colors
• Set Color Mode to Sequential.
• Set Maximum Color to: 006D9C
• Set Number of Bins to: 7
© 2022 Splunk Inc. All rights reserved. Creating Maps January 26, 2022 9
Task 4: Create a dashboard.
25. Save the visualization to a New Dashboard.
• Dashboard Title: Lab2
• Permissions: Private
• How do you want to build your dashboard? Classic Dashboards
• Panel Title: Sales by Province
Token Options
• Token: timeTok
• Default: Last 7 days
32. Click Apply.
© 2022 Splunk Inc. All rights reserved. Creating Maps January 26, 2022 10
Task 6: Set the map panel to use the time picker.
33. On the Sales by Province panel, click the Edit Search icon.
34. In the Time Range drop-down menu, select Shared Time Picker (timeTok).
Example:
© 2022 Splunk Inc. All rights reserved. Creating Maps January 26, 2022 11
Challenge Lab Exercise - Optional
Scenario: The sales team likes the dashboard, but they want it to use a custom SVG for the map of
Canada. They supplied a wireframe to use as a guide. The dashboard includes the following:
- Map of Canada
Wireframe:
© 2022 Splunk Inc. All rights reserved. Creating Maps January 26, 2022 12
Task 2: Add a Choropleth SVG.
13. Click the +Add Chart icon.
14. Select ChoroplethSVG.
NOTE: In the current release, set the dimensions of a choropleth SVG visualization before importing
the SVG file. Setting the dimensions after importing the file will not change the image size.
© 2022 Splunk Inc. All rights reserved. Creating Maps January 26, 2022 13
Example:
© 2022 Splunk Inc. All rights reserved. Creating Maps January 26, 2022 14
Lab Exercise 3 – Customize Maps
Description
Create a cluster map and customize its marker colors. Add a drilldown that captures the latitude
and longitude from a user click in a token. Then, use the token to customize a search.
Scenario: The sales team wants a global map of vendors that shows regions with strong, moderate
and weak sales. The dashboard should have a table below the map to display more
information for a marker that is clicked on. The dashboard includes the following:
- Time range input
- World map of retail sales
- Table listing vendors
Wireframe:
© 2022 Splunk Inc. All rights reserved. Creating Maps January 26, 2022 15
Task 1: Create a dashboard.
1. Click Dashboards.
2. Click Create New Dashboard and use the following settings:
• Dashboard Title: Lab3
• Permissions: Private
• Classic Dashboards
3. Click Create.
NOTE: Notice this search creates three fields, Strong, Moderate and Weak for ranges of sales.
These will be used to color the markers on the map.
© 2022 Splunk Inc. All rights reserved. Creating Maps January 26, 2022 16
Task 4: Use custom map tiles.
13. Click the Format icon on the Retail Sales panel.
14. Select Tiles.
15. In the populate from preset configuration dropdown
select Open Street Map.
Example:
© 2022 Splunk Inc. All rights reserved. Creating Maps January 26, 2022 17
Task 5: Add a drilldown.
20. Click Edit.
21. On the map panel, click the More Options button and select Edit Drilldown.
22. Select Manage tokens on this dashboard from the On Click drop-down menu.
23. Click in the Token name box and enter: bounds.north
24. Click in the Token value box and enter: $click.bounds.north$
25. Click + Add New three times and enter the following settings:
Set: bounds.south = $click.bounds.south$
Set: bounds.east = $click.bounds.east$
Set: bounds.west = $click.bounds.west$
26. Click Apply.
© 2022 Splunk Inc. All rights reserved. Creating Maps January 26, 2022 18
37. Between the opening and closing <init> elements, set default values for the map tokens.
<form>
<init>
<set token="bounds.north">37*</set>
<set token="bounds.east">37*</set>
<set token="bounds.south">-123*</set>
<set token="bounds.west">-122*</set>
</init>
...
38. Click Save and reload your browser.
Notice the table populated immediately after reloading the browser.
39. Mouse over the clusters. Notice green, blue and orange show Strong, Moderate, and Weak in the
rollover. These are created by the eval command in the search
40. Click a marker. Notice the table updates.
41. Zoom in on the map. Notice more markers appear.
42. Change the time range. Notice the map resets to the default zoom level.
Example:
© 2022 Splunk Inc. All rights reserved. Creating Maps January 26, 2022 19