How it works...

Let's break down the search piece by piece:

Search fragment

Description

index=main sourcetype=log4j

In this example, you are searching for our application's logs that have the log4j sourcetype.

| transaction sessionId maxspan=30m

Using the transaction command, you group together all events that share the same sessionId in a 30-minute span.

| search requestType="checkout" paymentReceived="Y"

Using the search command, you limit the grouped results to those that have only a checkout event and where the payment was received. In this visualization, a purchase does not qualify for consideration if it was not successfully processed.

| stats avg(total) AS Avg_Spent by category

Using the stats command, you calculate ...

Get Splunk Operational Intelligence Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.