LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-04-2007, 10:37 AM   #1
jonette20
Member
 
Registered: Jul 2007
Location: Ohio
Distribution: Ubuntu 7.04
Posts: 65

Rep: Reputation: 15
Adding date and time to Squid access.log


Hi,

In Squid, my access.log does not show time & date like the cache.log.
It allows you to insert a time & date, but how do u set it up to show the time and date automatically?

Thanks
jonette20
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 10-05-2007, 03:44 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,159
Blog Entries: 1

Rep: Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021
Open your squid.conf and search for the line that starts with access_log or cache_access_log and looks like:
Code:
access_log /var/log/squid/access.log squid
Of course the path to the logfile may vary in your case.
Note the last keyword (in this case squid, but it could be common, combined, squidmime). Then look for the line that starts with logformat <keyword> and change "%ts.%03tu" with "%tl" fro local time or "%tg" fro GMT time. If the line does not exist you should add it. For the above example it should changed from:
Code:
logformat squid  %ts.%03tu %6tr %>a %Ss/%03Hs %<st %rm %ru %un %Sh/%<A %mt
to:
Code:
logformat squid %tl %6tr %>a %Ss/%03Hs %<st %rm %ru %un %Sh/%<A %mt
You can take a look at squid.conf.default that comes with squid and it's well documented to see other available options for customizing your logs.

Regards
 
2 members found this post helpful.
Old 05-31-2008, 12:11 AM   #3
madsere
LQ Newbie
 
Registered: May 2006
Posts: 3

Rep: Reputation: 0
This is not correct. If you add the "logformat" keyword to squid.conf it throws an error on restart:

Stopping squid: 2008/05/31 05:03:28| parseConfigFile: line 704 unrecognized: 'logformat squid %tl %6tr %>a %Ss/%03Hs %<st %rm %ru %un %Sh/%<A %mt'

You can get the date by adding the line:

emulate_httpd_log on

This is explained in the squid.conf.default:

# TAG: emulate_httpd_log on|off
# The Cache can emulate the log file format which many 'httpd'
# programs use. To disable/enable this emulation, set
# emulate_httpd_log to 'off' or 'on'. The default
# is to use the native log format since it includes useful
# information Squid-specific log analyzers use.
#
#Default:
# emulate_httpd_log off
 
Old 06-02-2008, 11:32 AM   #4
jonette20
Member
 
Registered: Jul 2007
Location: Ohio
Distribution: Ubuntu 7.04
Posts: 65

Original Poster
Rep: Reputation: 15
Hi,

I used the logformat line in my squid.conf file and had no problems when Squid started up.
My access.log is now showing the time and date, as I wanted.

Not saying that madsere didn't get an error, just saying that it was the correct solution for me.

FYI
 
Old 06-02-2008, 11:12 PM   #5
madsere
LQ Newbie
 
Registered: May 2006
Posts: 3

Rep: Reputation: 0
Maybe different versions of Squid? I use Version 2.5.STABLE6.
 
Old 09-21-2009, 07:41 AM   #6
jazz13
LQ Newbie
 
Registered: Aug 2009
Location: Ukraine
Distribution: Archlinux
Posts: 6

Rep: Reputation: 2
helped me, thanks for info
 
  


Reply

Tags
accesslog, date, format, squid


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
convert LAN IP address to Host Name when I give cmd tail -f /var/log/squid/access.log rs15 Linux - Networking 6 01-22-2012 01:45 AM
Squid Access Logs date wise the_gripmaster Linux - Software 1 10-03-2007 09:38 PM
how to add date n time in proxy access.log sunlinux Linux - Networking 3 08-23-2007 06:54 AM
access.log (squid) file, adding Logins mizard Linux - Networking 4 09-27-2005 07:45 AM
My squid won't fill /var/log/squid/access.log linuxlah Linux - General 5 10-06-2003 10:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:49 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