Splunk Search

multiple searches in multiple sourcetypes resulting in a single chart

sailey
New Member

Below are the few patterns that I wanted to search from multiple sourcetypes and get the count. I have around 50 patterns.
Is the only way to write OR in between each search and get the counts in a single chart or is there any other better way.

Login status is
Account details flow for Apple Phone for user Id XXXXXX
Payment status and XXXXX YYYYYYY
Account details flow for Android Phone for user Id XXXXXX
finger print status of User id YYYYY
Transfer account status ZZZZZZ AAAAAA

Tags (1)
0 Karma

gokadroid
Motivator

I am not sure how befitting it is in your scenario but if Idea is just to avoid writing OR(s) between 50 patterns to search then can you try this:

1) Make a csv file of all your pattern and upload it as a lookup say patterns.csv which has fieldname (say) PatternField

PatternField
Login status is
Account details flow for Apple Phone for user Id
Payment status and
Account details flow for Android Phone for user Id
finger print status of User id
Transfer account status

After that use the below query to complete your search by replacing your sourcetype names for "A", "B", "C" and so on:

sourcetype=A OR sourcetype=B OR sourcetype=C ([|inputlookup patterns.csv | fields PatternField | return 50 $PatternField ] )

Hope this helps.

0 Karma
Get Updates on the Splunk Community!

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...