Splunk Search

Find the string and the number of occurences

gowthamjs
New Member

Hi,

I have a log file that has a set of information about some users. Each of the users have an id and the same is logged to the file when they login to the application. I am trying to figure the best way to find the number of visits made by users everyday. Please let me know, if you have any thoughts on the same. Thanks!

0 Karma

mayurr98
Super Champion

I think you want something like this

Suppose you have a field called id which is having all the users list. Also having the unique_keyword when they login to the application.
In that case if you want the number of number of occurrences for the particular id everyday then you can try something like this

index=<your_index> | timechart span=1d count by id

If id field is not extracted then you have to write regex for it.

Let me know if this helps!

0 Karma

gowthamjs
New Member

Hi,

In my case, only unique id is logged when a user logs in and it may be the same even if user logs in multiple times. I am trying to get the number of visits made by each user in a given day.

Thanks,
Gowtham

0 Karma

mayurr98
Super Champion

then try this

index=<your_index> <unique_keyword_for_login_from_the_event> | stats  count(unique_id) as count by unique_id
0 Karma

mayurr98
Super Champion

could you please share some sample events? and tell us what do you want to achieve. It is very difficult to understand the above description. you can anonymize any important data in the event.

0 Karma
Get Updates on the Splunk Community!

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...