LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-19-2013, 06:59 AM   #1
mat1_8
LQ Newbie
 
Registered: Apr 2013
Posts: 10

Rep: Reputation: Disabled
Squid Log - Total time column


Hi all,

In the squid log is it possible to add another column to display the total time that a user spent on a particular website please? Currently I only have the date and time when the user accessed the website and I would like to have another one for total time if possible. Thank you

Regards,
Matthew Vassallo
 
Old 04-19-2013, 08:15 AM   #2
cliffordw
Member
 
Registered: Jan 2012
Location: South Africa
Posts: 506

Rep: Reputation: 194Reputation: 194
Hi Matthew,

Welcome to the forums!

As far as I know squid doesn't track this sort of info, and has no easy way of doing so. The nature of the internet makes this hard to do, as all the proxy sees is a number of discreet requests for web pages. It has no knowledge of any form of "session", and no way of knowing whether these requests are related or not.

I've never really looked into this, but expect that you may be able to estimate the time spent on a site based on your own calculations by looking at the timestamps of individual requests, and calculating the difference between the 1st and last requests you consider to be related.

You'll have to make some assumptions, though. As an example, between the time I got to your post, and the time I replied, I spent 20 minutes doing other things. You can't just assume from the 2 timestamps in a log that I spent that time on this site. At the very least I think you would have to decide on the maximum time between 2 requests that you would consider part of the same session/visit (for example 5 minutes). You probably need to take into account visits to other sites during this same time period, as some people tend to have multiple sites open at a time.

Also note that some pages may automatically refresh from time to time, even when you're not actively busy on the page (for example to load fresh ads). I often open dozens of tabs at a time for articles I want to read, and only get around to reading them hours later. The stats for such pages might not reflect reality, as it might seem like I spent hours on the site, while in reality I opened the page, left it unattended for hours, and then spent 2 minutes there to read the article.

Lastly keep in mind that in most cases there is no log entry when I leave the site (close my browser window/tab), This could skew the stats for sites with only a few requests, but is probably less significant for sites where someone spent quite a lot of time browsing around.

You might be able to find some ideas from the source code for Squint, a script which tries to report on who is spending the most time and resources browsing the internet overall via a squid proxy. It is available at http://www.ledge.co.za/software/squint/index.php.

Good luck!

Clifford
 
Old 04-22-2013, 02:47 AM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 7.7 (?), Centos 8.1
Posts: 17,814

Rep: Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553Reputation: 2553
This is the key phrase really
Quote:
number of discreet requests for web pages
HTTP is a connectionless protocol ie each page request is dealt with as if new.
It is possible for the server fake a 'session' effect, by means of various tricks, but its not a connection (that is session) oriented protocol like eg ssh.

Incidentally, I think he meant discrete, not discreet (unless we're talking naughty pages )
 
Old 04-22-2013, 03:07 AM   #4
mat1_8
LQ Newbie
 
Registered: Apr 2013
Posts: 10

Original Poster
Rep: Reputation: Disabled
Thanks a lot guys I appreciate your help
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] where is time on the squid log file bunpis Linux - Newbie 2 04-13-2011 06:15 PM
Squid log report by time yoachan Linux - Server 2 04-13-2011 08:35 AM
C programming, adding up array column total dmckay Programming 2 01-25-2010 04:27 PM
Adding date and time to Squid access.log jonette20 Linux - General 5 09-21-2009 08:41 AM
the significance and name of the 5th column of /var/log/auth.log (ubuntu server)? CoffeeKing!!! Linux - Security 4 02-05-2009 08:32 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:11 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration