Splunk Search

Is using the transaction command an overkill in this case?

jliu531
Engager

If I have two searches as below (uniqueId is a common field exists in both searches, while field1, field2 are unique fields only applying to it search)

EVENT_CONTAIN_SOME_KEYWORD | table uniqueId, field1
EVENT_CONTAIN_ANOTHER_KEYWORD | table uniqueId, field2

Then i can use the transaction command to combine the table (it is safe to assume there are only one field1 and one field2 for every uniqueId)

EVENT_CONTAIN_SOME_KEYWORD  OR EVENT_CONTAIN_ANOTHER_KEYWORD
| transaction  uniqueId
| table uniqueId, field1, field2

I am not using any of those startswith / endswith / maxspan / maxpause args really.
Is there a way to avoid using transaction, and make my query more efficient?

Thanks!

Tags (1)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

Try stats.

EVENT_CONTAIN_SOME_KEYWORD OR EVENT_CONTAIN_ANOTHER_KEYWORD
| stats values(field1) as field1, values(field2) as field2 by uniqueId
| table uniqueId, field1, field2
---
If this reply helps you, Karma would be appreciated.
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Mastering Threat Intelligence in ES 8.5, Splunk AI Assistant v2, and More from Splunk ...

Splunk Lantern is Splunk’s customer success center that provides practical guidance from Splunk experts on key ...

Break the Build: Inside the KubeDoom Lounge at .conf26

    You step up to the machine. The pixelated corridors of a certain 1993 FPS load in front of you, EMP Pulse ...

Splunk Auto Ingestion Parallel Pipeline Scaling

Why this feature matters Many Splunk environments experience ingestion pressure long before the host is fully ...