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!

A Four-Part Event Series: Full Stack Observability For the AI Era

As AI reshapes applications, infrastructure, and the way teams operate, the traditional boundaries of ...

SOC4Kafka - New Kafka Connector Powered by OpenTelemetry

The new SOC4Kafka connector, built on OpenTelemetry, enables the collection of Kafka messages and forwards ...

Event Series: Level up your SOC: Advancing with Splunk Enterprise Security

AI has fundamentally raised the stakes for security operations, and this three-part series is your guide to ...