0

I have been using Splunk as a log monitoring tool but recently got to know that we will get network traffic and number of hits per URL.

For example, I have a URL like the one below and I want to know the total number of hits that occurred over the last week:

https://stackoverflow.com/

What would be the query that I need to write to get the number of hits (count) per day/period of time in Splunk?

I tried this:

"url" | stats sum(linecount) as Total

which is returning >1000 hits count for the last 15 minutes, which is not correct.

Thanks in advance.

freginold
  • 3,946
  • 3
  • 13
  • 28
Praveen Kumar Mekala
  • 628
  • 1
  • 10
  • 26
  • Have you tried any queries yet? If so, which ones and what were the results? Are you trying to count unique visitors or total hits? – freginold Oct 10 '17 at 12:44
  • 1
    @freginold yes I tried this : "url" | stats sum(linecount) as Total , which is returning >1000 hits count for last 15 mins which is not correct. yes, I need total hits. – Praveen Kumar Mekala Oct 10 '17 at 12:58

3 Answers3

2

It would be quick and accurate when you mention index, host and site names.

index name = environment of the application like SIT/UAT/QA/pre-prod/production

host name = In which instance application is hosted

site name = in my example it will be https://stackoverflow.com

Query = index="SIT*" host="*host_name*" "https://stackoverflow.com" "/questions" | stats sum(linecount) as Total

by executing above query I can get number of hits for stackoverflow.com/questions url.

The above query has given accurate results and in splunk we do have drop down option to select period of time.

Praveen Kumar Mekala
  • 628
  • 1
  • 10
  • 26
1

Try one of these queries to return the total number of hits:

"url" | stats count

Or:

"url" | stats sum(count) as total
freginold
  • 3,946
  • 3
  • 13
  • 28
0

Hi This below query is one of good example to get the site requests

index="bcom" "https://www.bloomingdales.com/" | stats sum(linecount) as Total

@Ravindra'S

  • 1
    Welcome to SO! When you reply to a question, include in your answer some additional information, not just the answer. In this case, there are some other answers so you should expose Cons and Pros of your point of view. – David García Bodego Oct 20 '19 at 11:35