Splunk Search

Charting the 2 fields on the same chart.

justinfranks
Path Finder

I have a log of login timestamps. I would like to display the total count and total unique value count on the same bar chart.

Here is my search:

sourcetype="etv" cname="*" ur="*" | stats dc(u) as "unique", count by u | chart sum(count) as "Total Logins", sum(unique) as "Total Unique Logins"

Where 'u' is the UserID.

However, this search charts the "Total Logins" by "Total Unique Logins", which is not what I want.

alt text

Is there a way chart this information, split by their field names?

Tags (2)
0 Karma
1 Solution

lguinn2
Legend

Would this work

sourcetype="etv" cname="*" ur="*" 
| stats dc(u) as "Total Unique Logins" count as "Total Logins"
| transpose

And then choose the Visualization tab

(After some thought, I figured out that you can simplify your calculations.)

View solution in original post

lguinn2
Legend

Would this work

sourcetype="etv" cname="*" ur="*" 
| stats dc(u) as "Total Unique Logins" count as "Total Logins"
| transpose

And then choose the Visualization tab

(After some thought, I figured out that you can simplify your calculations.)

justinfranks
Path Finder

Thanks! The transpose command was what I was missing.

0 Karma

lguinn2
Legend
sourcetype="etv" cname="*" ur="*" 
| stats dc(u) as "unique", count by u 
| stats sum(count) as "Total Logins", sum(unique) as "Total Unique Logins"

should work

justinfranks
Path Finder

I thought so too but here is what I get:

http://i.imgur.com/UR0dLKB.png

However, I'd like to have them on different bars of the count on the bottom.

0 Karma

rsennett_splunk
Splunk Employee
Splunk Employee

Incidentally... Depending on the difference between total logins and unique logins, you may need to set the y-axis to "log" rather than "linear" in order to see the relationship between them.

With Splunk... the answer is always "YES!". It just might require more regex than you're prepared for!
0 Karma
Get Updates on the Splunk Community!

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...

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 ...