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 10-03-2007, 06:30 PM   #1
the_gripmaster
Member
 
Registered: Jul 2004
Location: VIC, Australia
Distribution: RHEL, CentOS, Ubuntu Server, Ubuntu
Posts: 357

Rep: Reputation: 38
Squid Access Logs date wise


I am using Squid 2.6 on RHEL 5. I want a separate access log everyday to be created automatically instead of one big access.log file in /var/log/squid

Is there a way to do this editing the /etc/squid/squid.conf file?

Thanks in advance.
 
Old 10-03-2007, 09:38 PM   #2
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,123

Rep: Reputation: 151Reputation: 151
You can use logrotate to do this (are you using it for other log files)? You can create an entry for squid in /etc/logrotate.d/squid and add the following content. This example rotates weekly for 5 weeks. The postrotate entry of /usr/local/squid/sbin/squid -k rotate causes squid to close and re-open its logs so no silliness happens with open file handles For this to happen, your squid.conf file needs to have logfile_rotate set to 0:
Code:
/var/log/squid/access.log {
    weekly
    rotate 5
    copytruncate
    compress
    notifempty
    missingok
}
/var/log/squid/cache.log {
    weekly
    rotate 5
    copytruncate
    compress
    notifempty
    missingok
}

/var/log/squid/store.log {
    weekly
    rotate 5
    copytruncate
    compress
    notifempty
    missingok
# This script asks squid to rotate its logs on its own.
# Restarting squid is a long process and it is not worth
# doing it just to rotate logs
    postrotate
      /usr/local/squid/sbin/squid -k rotate
    endscript
}
 
  


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
Squid : Multiple access log files (ACL Wise) suhas! Linux - Server 0 09-24-2007 12:43 AM
delete files date wise hardeep_ubhi Linux - General 1 11-16-2004 02:07 AM
Squid is running but my logs are not being written Dagman Linux - Software 5 07-13-2004 08:12 AM
bandwidth allocation by user wise and ip wise basbosco Linux - Networking 1 11-12-2003 02:54 AM
Squid and rotating logs using crond 80s Linux - Software 0 02-21-2003 03:53 AM


All times are GMT -5. The time now is 03:42 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration