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!

Developer Spotlight with Paul Stout

Welcome to our very first developer spotlight release series where we'll feature some awesome Splunk ...

State of Splunk Careers 2024: Maximizing Career Outcomes and the Continued Value of ...

For the past four years, Splunk has partnered with Enterprise Strategy Group to conduct a survey that gauges ...

Data-Driven Success: Splunk & Financial Services

Splunk streamlines the process of extracting insights from large volumes of data. In this fast-paced world, ...