Splunk Search

I need complete this query find the top 5 viewed products referred by a domain.

EdwinOssa
Engager

This is my sentence but is not completed. I can't find the solution on Doc.

 

index=main sourcetype=acc* action=view [search sourcetype=acc* status=200 action=view | top limit=5 referer_domain | table referer_domain productName] | stats count,values(productName),distinct_count(productId) by referer_domain

Labels (1)
0 Karma
1 Solution

inventsekar
SplunkTrust
SplunkTrust

Hi @EdwinOssa your query is perfect one.. the field "productName" is not available. only "ProductId" is available. 

so, you could run:

index=main sourcetype=acc* action=view [search sourcetype=acc* status=200 action=view | top limit=5 referer_domain | table referer_domain] | stats count,values(productId),distinct_count(productId) by referer_domain

access.pngaccess1.png

thanks and best regards,
Sekar

PS - If this or any post helped you in any way, pls consider upvoting, thanks for reading !

View solution in original post

inventsekar
SplunkTrust
SplunkTrust

Hi @EdwinOssa your query is perfect one.. the field "productName" is not available. only "ProductId" is available. 

so, you could run:

index=main sourcetype=acc* action=view [search sourcetype=acc* status=200 action=view | top limit=5 referer_domain | table referer_domain] | stats count,values(productId),distinct_count(productId) by referer_domain

access.pngaccess1.png

thanks and best regards,
Sekar

PS - If this or any post helped you in any way, pls consider upvoting, thanks for reading !

EdwinOssa
Engager

Thank you so much for your help. Appreciated your time for reply my request. I'm new learning splunk and I have some difficulties to find some results. could you help me one last time with this query.

 

Plot a trellis chart showing the average time spent on the Buttercup Games website for each user session by browser.

-this is my solution but I'm stuck with the average.

index=main sourcetype=acc* referer_domain=http://www.buttercupgames.com action=view | top limit=20 useragent | chart avg(percent) 

after this I only got one line 

0 Karma

inventsekar
SplunkTrust
SplunkTrust

Sure @EdwinOssa , no problems.. i appreciate your questions and wish you best of luck for your splunk learnings .. (sorry for the late reply)

1) the "chart avg(percent)" is missing a "by" field.. generally

"chart avg(time_spent) by referer_domain"

Please check the search reference document for chart command syntax and examples:

https://docs.splunk.com/Documentation/Splunk/8.0.6/SearchReference/Chart#Basic_examples

2) the time_spent field is not available on the logs i think(i am not sure of the last number that appears on these logs.. that may be the time_spent, but i am not sure)

3) referer_domain is just 4 on these logs. so something missing on your requirement. 

Please let us know more details. 

thanks and best regards,
Sekar

PS - If this or any post helped you in any way, pls consider upvoting, thanks for reading !
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...