Reporting

Web access logs - how to identify the first hit of the visit, and extract certain fields?

lepinepd
Explorer

Trying to create some basic web analytics reports, like top referrers, top landing pages, etc. These things require identifying the first hit of the visit. Have been playing with transaction to group the events into a "session". But then not getting correct results when trying "streamstats first(req_time) as first_hit by user".

Anybody cracked this fundamental issue of finding the first/last hit of a web visit in access logs?

Tags (3)
0 Karma

charris_splunk
Splunk Employee
Splunk Employee

Check out eventstats and the first() function:
http://docs.splunk.com/Documentation/Splunk/6.1.3/SearchReference/eventstats

I think you're after something like this:

sourcetype=access* | eventstats dc(session_id) as Visits | stats count as Views, first(Visits) as Visits by uri

If you don't have a session_id logged, consider using the clientip a mashup of client_ip and useragent :

sourcetype=access* | eval uid = clientip + useragent | eventstats dc(uid) as Visits | stats count as Views, first(Visits) as Visits by uri

0 Karma
Get Updates on the Splunk Community!

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...