Splunk Search

How to get a field from a unique transaction and group another transaction by the unique field?

jegreene
New Member

I have an event that will generate a login string for a user. Once that login string is generated, the connection string should be tied to that very same login string and be able to be grouped by. However, that login string only exists in the initial connection.

When the connection string is generated, a unique token is tied to it, lets say it's 10. I want to count the number of times the unique token happens (lets say it's 45) and group by the login string.

Variable:
LoginString
Connections
UT=10
UT=45

So essentially I want to grab the login string where UT=10 and then tie that LoginString to the Connections. I want to then count the number of times UT=45 happens on that same connection, and group that count by LoginString in a timechart

0 Karma

sundareshr
Legend

Try this

base search | eventstats values(loginString) as LS by Connections | where UT=45 | stats count by LS
0 Karma

sundareshr
Legend

Not sure I understand your question. Sharing some samples might help. In the meantime, try something like this

base search | eventstats values(login_string) as LS by unique_token | stats count(eval(UT=45)) by Connection_String
0 Karma

somesoni2
Revered Legend

Can we have some sample events.

0 Karma

jegreene
New Member
[01/May/2015:20:39:47 -0400] Connections=12345  - RESULT error=0 UT=10 nentries=0 etime=0.000000
[01/May/2015:20:39:47 -0400] Connections=12345  random=1 - RESULT err=0 UT=45 nentries=0 etime=0.000000 LoginString="randomString"
[01/May/2015:20:39:47 -0400] Connections=12345  - RESULT error=0 UT=10 nentries=0 etime=0.000000
[01/May/2015:20:39:47 -0400] Connections=223333  - RESULT error=0 UT=10 nentries=0 etime=0.000000
[01/May/2015:20:39:47 -0400] Connections=223333  random=1 - RESULT err=0 UT=45 nentries=0 etime=0.000000 LoginString="veryUnRandom"
[01/May/2015:20:39:47 -0400] Connections=55555  - RESULT error=0 UT=10 nentries=0 etime=0.000000
[01/May/2015:20:39:47 -0400] Connections=55555  random=1 - RESULT err=0 UT=45 nentries=0 etime=0.000000 LoginString="veryUnRandom"
[01/May/2015:20:39:47 -0400] Connections=55555  - RESULT error=0 UT=10 nentries=0 etime=0.000000
[01/May/2015:20:39:47 -0400] Connections=55555  - RESULT error=0 UT=10 nentries=0 etime=0.000000
[01/May/2015:20:39:47 -0400] Connections=55555  random=1 - RESULT err=0 UT=45 nentries=0 etime=0.000000 LoginString="veryUnRandom"

In this instance I would want my timechart to have 2 for randomString and 1 for notSoRandom and 3 for VeryUnRandom

The issue I am having is how do I group by the LoginString. Right now if I transaction by Connections I have a giant string of the UT=45 and UT=10 but all I want is the count for the number of UT=10 appears in the event

0 Karma
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...