Courseiva
Transactions and Event CorrelationhardMultiple ChoiceObjective-mapped

Limiting Events Per Transaction with maxevents in Splunk

A telecom company monitors call detail records (CDR). Each call has a unique call_id, and events are generated at each network node (setup, ringing, answer, hangup) with timestamps. The events are from different sourcetypes (cdr_setup, cdr_ring, etc.) and are indexed in near real-time. The analyst needs to correlate all events for the same call_id to calculate call duration. The current search is: `index=telecom sourcetype=cdr_* | transaction call_id maxspan=2h`. This search works but sometimes produces huge transactions (100+ events) due to noisy data, causing memory errors. The analyst has identified that each call should have exactly 4 events: setup, ringing, answer, hangup. Which approach would best correlation with minimal resource usage?

Quick Answer

The problem here isn't the correlation logic itself, since transaction call_id maxspan=2h already groups the right events by the right key; the problem is that noisy data occasionally produces transactions far larger than the four events a real call should have, and those oversized groups are what's driving the memory errors. maxevents=4 addresses this directly by capping how many events the transaction command will accumulate into any single transaction, so once a call_id's group reaches four events, no further events get added to it, regardless of how much additional noisy data shares that call_id. Because this limit is enforced during the transaction operation itself rather than afterward, it prevents the memory spike from ever occurring rather than cleaning up an oversized result after the fact. This matches the domain knowledge given in the scenario, that a well-formed call record has exactly four stages, setup, ringing, answer, and hangup, so constraining the transaction to that known event count is both a data-quality safeguard and a resource control at the same time. When you see a transaction command producing abnormally large groups due to noisy or malformed data, and the expected event count per group is known in advance, maxevents is the parameter built specifically for that constraint.

⚠ Common exam trap

Splunk often tests the misconception that post-filtering (e.g., `where mvcount(_raw) = 4`) is equivalent to using `maxevents`, but the trap is that post-filtering does not prevent memory errors during the transaction assembly phase.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Use `transaction call_id maxevents=4 maxspan=2h` to limit to exactly 4 events.

`maxevents=4` directly limits the transaction to exactly four events per call_id, preventing memory errors from noisy data while ensuring each transaction contains the expected setup, ringing, answer, and hangup events. This constraint is applied during the transaction command itself, reducing resource usage by discarding oversized groups immediately rather than post-processing.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Use `transaction call_id maxevents=4 maxspan=2h` to limit to exactly 4 events.

    Why this is correct

    Correct: maxevents=4 ensures only the expected events are grouped, reducing memory and processing time.

  • Use `transaction call_id maxspan=2h` and then filter using `where mvcount(_raw) = 4`.

    Why it's wrong here

    Incorrect: This still generates large transactions in memory before filtering, causing memory errors.

  • Use `eventstats count by call_id` and then filter.

    Why it's wrong here

    Incorrect: eventstats does not correlate events in time order or group them into a single event per call.

  • Use `search` with `call_id=*` and then use `streamstats` to calculate duration per call.

    Why it's wrong here

    Incorrect: streamstats processes events sequentially without clear grouping; it doesn’t create a single event per call with all fields.

About these practice questions

One of 475 original SPLK-1002 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Same concept, more angles

2 more ways this is tested on SPLK-1002

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. An analyst uses transaction to group web requests by session_id. Some transactions are unexpectedly large, containing hundreds of events. What parameter should be adjusted to limit the number of events per transaction?

medium
  • A.maxspan
  • B.maxpause
  • C.mvcount
  • D.maxevents

Why D: Maxevents limits the number of events in a transaction. Option A (maxspan) limits the maximum time span of the transaction. Option B (maxpause) limits the maximum pause between events. Option C (mvcount) is used to count multivalue fields, not to limit event count.

Variation 2. A financial services company uses Splunk to monitor transactions between internal systems. Each transaction consists of a request event and a response event with identical fields: transaction_id, timestamp, component, status. The request event has component='app' and status='request'; the response event has component='db' and status='success' or 'failure'. The analyst runs the following search to correlate them: `index=main (component=app OR component=db) | transaction transaction_id maxspan=30s`. However, they notice that the search takes too long and often times out when there are many transactions. What change would most effectively reduce search time while still correctly grouping request-response pairs?

easy
  • A.Use `transaction transaction_id maxspan=30s` with a time range picker to limit the search to a smaller time window.
  • B.Use `stats values(*) as * by transaction_id` and then filter.
  • C.Use `rename component to type` and then use `transaction`.
  • D.Use `transaction transaction_id maxevents=2 maxspan=30s`.

Why D: Adding `maxevents=2` limits each transaction to exactly two events (a request and a response), preventing large groupings that cause memory issues and timeouts. The `maxspan=30s` already sets a time window. Option A (using a time range picker) does not address the internal grouping inefficiency. Option B (`stats values(*) as * by transaction_id`) does not maintain event order and can mix fields, failing to properly correlate request-response pairs. Option C (renaming component to type) does not improve performance.

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This SPLK-1002 practice question is part of Courseiva's free Splunk certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the SPLK-1002 exam.