website usage log

Web hosting discussion, programming, and shared and dedicated servers.
3 posts Page 1 of 1
by racerlupine » Mon Mar 13, 2023 12:53 am
Is there a way I can see which useragents visited a given URL? Or, put another way, can I see which URLs were visited by a given useragent?

thanks

RACER
by joemuller » Tue Mar 14, 2023 6:48 pm
racerlupine wrote:
Is there a way I can see which useragents visited a given URL? Or, put another way, can I see which URLs were visited by a given useragent?


You'll need to look at the access logs for your site, as the Webalyzer stats available via Member Tools only give a breakdown of the total number and percentage of requests from a user-agents. If you have shell access enabled on your account, you can do search for a given user agent like so:

Code: Select all

$ zgrep Firefox /logs/by_user/example.com/access_log*


Here's an example of what the average entry in the log looks like:

Code: Select all

1.2.3.4 example.com - [13/Mar/2023:00:41:11 -0700] "GET /wp-login.php HTTP/1.1" 200 2974 "" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/109.0"


Here's an example one-liner you can do to find all the user agents that visited a URL: (adapted from this guide)

Code: Select all

zgrep URL_GOES_HERE /logs/by_user/example.com/access_log* | awk -F\" '{print $6}' | sort | uniq -c | sort -fr


I hope the above info helps out!

-- Joe
I'm a proud employee of Sonic.net! :-)
by racerlupine » Thu Mar 16, 2023 11:52 pm
Joe,

Thanks for this! Especially for the link to the guide.

RACER
3 posts Page 1 of 1

Who is online

In total there are 10 users online :: 0 registered, 0 hidden and 10 guests (based on users active over the past 5 minutes)
Most users ever online was 999 on Mon May 10, 2021 1:02 am

Users browsing this forum: No registered users and 10 guests