Splunk Search

no events for distinct logins into an app in the last 30 days

anikeshp7
Path Finder

Requirement- I want to display distinct logins into an app in the last 30 days.

My query returns zero events.

index="123" AND organizationId="011110012D" logRecordType=ailtn ("appName":"Cash_Platform" AND "appType":"Console") [|inputlookup "test"|table UserID|rename UserID as userId]|lookup test.csv UserID AS userId |timechart span=1mon dc(userId) as distinctLogins

 

Here App name is Cash_Platform and lookup file test.csv contains  UserID and UserNames

 

Any Suggestions where am I doing wrong or how this can be improved to return valid events.

 

Thanks

Labels (3)
0 Karma

anikeshp7
Path Finder

yup. I also have a requirement where I want to show time spent by user on the console in above query. How should I achieve that ?

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Have you worked out where you are losing events?

index="123" AND organizationId="011110012D" logRecordType=ailtn ("appName":"Cash_Platform" AND "appType":"Console")

By the way, AND is implied and it looks like you are checking JSON fields so you may need to escape the double quotes around the keys and values,  so try:

index="123" AND organizationId="011110012D" logRecordType=ailtn "\"appName\":\"Cash_Platform\"" "\"appType\":\"Console\""

 If this has your expected events, try:

index="123" AND organizationId="011110012D" logRecordType=ailtn ("appName":"Cash_Platform" AND "appType":"Console") [|inputlookup "test"|table UserID|rename UserID as userId]

If you are still getting events, try:

index="123" AND organizationId="011110012D" logRecordType=ailtn ("appName":"Cash_Platform" AND "appType":"Console") [|inputlookup "test"|table UserID|rename UserID as userId]|lookup test.csv UserID AS userId

 

anikeshp7
Path Finder

@ITWhispererI just simplified the query further to get unique logins in last 30 days

index="123" AND organizationId="011110012D" logRecordType=ailtn ("appName":"Cash_Platform" AND "appType":"Console") earliest=-30d | dedup userId | lookup test.csv UserID AS userId | stats count(userId)

This is returning the events . 

I welcome any suggestions for improvement

++Now Im trying to display time spent by user on the app console . Dont know how to write query for this.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Does index="123" AND organizationId="011110012D" logRecordType=ailtn ("appName":"Cash_Platform" AND "appType":"Console") userId=* return any events? Do any of the userIds match what you are expecting?

0 Karma

anikeshp7
Path Finder

Hi @ITWhisperer it does retuen events with userId=*

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

and do any of them match with the UserId in "test"?

0 Karma
Get Updates on the Splunk Community!

Earn a $35 Gift Card for Answering our Splunk Admins & App Developer Survey

Survey for Splunk Admins and App Developers is open now! | Earn a $35 gift card!      Hello there,  Splunk ...

Continuing Innovation & New Integrations Unlock Full Stack Observability For Your ...

You’ve probably heard the latest about AppDynamics joining the Splunk Observability portfolio, deepening our ...

Monitoring Amazon Elastic Kubernetes Service (EKS)

As we’ve seen, integrating Kubernetes environments with Splunk Observability Cloud is a quick and easy way to ...