Punchcard visualization is another advanced visualization. It can be used to show insight from the data, and using those insights, informed business decisions can be made. Punchcard charts are used to visualize data by hour/day/week at the same time. A punchcard chart can be used to analyze the power consumption of a location over the week, sales on an e-commerce portal by hour of the day, and so on.
Let's see how punchcard visualization can be implemented on the Splunk dashboard.
Here is the search query to be run to get the output that will be required for punchcard visualization:
| inputcsv punchcard.csv | eval _time=strptime (Date, "%m/%e/%Y") | eval day=strftime (_time, "%a") | stats count by day, Transaction
The output of the preceding search query in the statistical form will be displayed as shown in the following screenshot:
The preceding tabular data, when shown in punchcard visualization, will appear as shown in the following diagram. The size of the circles is proportional to the count (occurrence) of the respective transaction over the distribution of days of the week. The different colors of the circles correspond to different transactions as listed on the right-hand side of the punchcard card visualization in the following diagram:
In the preceding punchcard visualization diagram, hovering the mouse on a circle will display the count value for each of the events of the hovered transaction. This functionality is coded in the punchcard.js
file and can be customized per user requirement.
Here are the steps to be taken in the Splunk dashboard to create a punchcard visualization similar to the previous diagram:
punchcard
directory from the downloaded app's static
folder to the respective app's static
directory, where punchcard visualization is to be implemented. Explained in the following are some scenarios:$SPLUNK_HOMEetcapps simple_xml_examplesappserverstaticcomponentspunchcard
directory are copied to the punchcard
directory of the search app located at $SPLUNK_HOMEetcappssearchappserverstaticcomponents
.autodiscover.js
, similar to what we have done in Sunburst sequence section in the previous section of this chapter. The dashboard script should look like the following:<dashboard script="autodiscover.js">
<panel>
section of the XML code of the dashboard to get the punchcard visualization. The id
used in the preceding search query should be the same in the managerid
section of the following code:3.133.131.168