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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...