Splunk Search

How to create a search check on a single day which a user had done  transactions for more than 3 different vendors?

splkjk
Explorer

Hello Splunkers, @SPL , Was working on some of the development activity, got stuck at some level.

We have a scenario where I need to check , on a single day which a user had done  transactions for more than 3 different vendors

Date User ID Vendor Transactions
10/5/2021 user 1

SAAS

(User1)

$$$$$
10/5/2021 user 2

PAAS

(User1)

$$$$$
10/7/2021 user 3 IAAS $$$$$
10/8/2021 user 4 AAA $$$$$
10/9/2021 user 5 CCCC $$$$$
10/10/2021 user 6 FFFF $$$$$
10/5/2021 user 7

XXXX

(User1)

$$$$$
10/6/2021 user 8 ZZZZ $$$$$
10/8/2021 user 9 EEE $$$$$
10/9/2021 user 10 QQQQ $$$$$
10/10/2021 user 11 SSSS $$$$$
10/11/2021 user 12 PPPP $$$$$
10/12/2021 user 13 WWW $$$$$
Labels (4)
0 Karma
1 Solution

gcusello
Legend

Hi @splkjk,

you could use the stats command, something like this:

(supponing that you already extracted the fields I'm using, otherwise you have to extract them)

index=your_index
| stats dc(Vendor) AS dc_vendor values(Vendor) AS Vendor BY User_ID
| rename User_ID As "User ID"

if possible don't use field names with spaces, you can rename fields at the end of the search.

Ciao.

Giuseppe

View solution in original post

gcusello
Legend

Hi @splkjk,

you could use the stats command, something like this:

(supponing that you already extracted the fields I'm using, otherwise you have to extract them)

index=your_index
| stats dc(Vendor) AS dc_vendor values(Vendor) AS Vendor BY User_ID
| rename User_ID As "User ID"

if possible don't use field names with spaces, you can rename fields at the end of the search.

Ciao.

Giuseppe

splkjk
Explorer

Thanks @gcusello , i was able to get the distinct count for the User ID who had done transactions with different vendor on same day, but after extracting i need to get the table in below format.
When i add the below query 

"table Date User_ID Vendor Transaction" the table gets populated for only User ID and Vendor, date and Transactions are not getting populated

Regards

DateUser IDVendorTransactions
10/5/2021user 1SAAS(User 1)$$$$$
10/5/2021PAAS(User1) 
10/5/2021XXXX (User1)$$$$$
0 Karma

gcusello
Legend

Hi @splkjk,

you have to add some option to the stats command, something like this:

index=your_index
| stats 
     dc(Vendor) AS dc_vendor 
     values(Vendor) AS Vendor 
     earliest(_time) AS Date
     values(Transaction) AS Transaction
     BY User_ID
| rename User_ID As "User ID"
| eval Date=strftime(Date,"%Y-%m-%d %H:%M:%S")
| table Date User_ID Vendor Transaction

Ciao.

Giuseppe

P.S.: Karma Points are appreciated 😉

Get Updates on the Splunk Community!

Improve Your Security Posture

Watch NowImprove Your Security PostureCustomers are at the center of everything we do at Splunk and security ...

Maximize the Value from Microsoft Defender with Splunk

 Watch NowJoin Splunk and Sens Consulting for this Security Edition Tech TalkWho should attend:  Security ...

This Week's Community Digest - Splunk Community Happenings [6.27.22]

Get the latest news and updates from the Splunk Community here! News From Splunk Answers ✍️ Splunk Answers is ...