Throughout this chapter, you have been building visualizations to provide insight into the operational performance of our e-commerce website. It can also be useful to understand the customers' views and the factors that might drive them to the website. This type of information is traditionally most useful for product or marketing folks. However, it can also be useful to gain an understanding around whether an item is increasing in popularity and if this could ultimately lead to additional customers and heavier load on the site.
In this recipe, you will write a Splunk search to calculate the average amount of money spent, split out by product category. You will then graphically present this data using a bar chart on a new Product Monitoring dashboard.
To step through this recipe, you will need a running Splunk Enterprise server, with the sample data loaded from Chapter 1, Play Time – Getting Data In. You should be familiar with the Splunk search bar, the time range picker, and the Visualization tab. It is not required, but is advisable, that you complete all the recipes up until this point.
Follow the given steps to use a bar chart to show average amount spent by category:
index=main sourcetype=log4j | transaction sessionId maxspan=30m | search requestType="checkout" | stats avg(total) AS Avg_Spent by category
cp03_average_spent_category
and click on Save. On the next screen, click on Add to Dashboard.Average Spent by Category
and select Report in the Panel Powered By field; then, click on Save:Let's break down the search piece by piece:
Search Fragment |
Description |
---|---|
|
In this example, we search for our application's logs that have the |
|
Using the |
|
Using the |
|
Using the |
The Visualization tab simply takes the time series output of the stats
command and overlays the given visualization. In this case, you overlaid a bar chart visualization.
3.145.186.6