how to add squid access log in /etc/newsyslog.conf

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

how to add squid access log in /etc/newsyslog.conf

Indunil Jayasooriya
Hi mics,


I want /etc/newsyslog.conf to generate /var/squid/logs/access.log  daily.
This is the entry I have added to /etc/newsyslog.conf file. But it does NOT
work.

*/var/squid/logs/access.log      _squid:_squid   640     14      *
@T00    Z       /var/squid/logs/squid.pid       30*


any comments ?


I referred to below urls

http://jamesoff.net/site/reference/squid-log-rotation-with-newsyslog/

http://lists.freebsd.org/pipermail/freebsd-questions/2007-July/154219.html

http://lists.freebsd.org/pipermail/freebsd-questions/2003-October/021765.html



--
cat /etc/motd

Thank you
Indunil Jayasooriya
http://www.theravadanet.net/
http://www.siyabas.lk/sinhala_how_to_install.html   -  Download Sinhala
Fonts

Reply | Threaded
Open this post in threaded view
|

Re: how to add squid access log in /etc/newsyslog.conf

Stuart Henderson
On 2015-07-13, Indunil Jayasooriya <[hidden email]> wrote:

> Hi mics,
>
>
> I want /etc/newsyslog.conf to generate /var/squid/logs/access.log  daily.
> This is the entry I have added to /etc/newsyslog.conf file. But it does NOT
> work.
>
> */var/squid/logs/access.log      _squid:_squid   640     14      *
> @T00    Z       /var/squid/logs/squid.pid       30*
>
>
> any comments ?
>
>
> I referred to below urls
>
> http://jamesoff.net/site/reference/squid-log-rotation-with-newsyslog/
>
> http://lists.freebsd.org/pipermail/freebsd-questions/2007-July/154219.html
>
> http://lists.freebsd.org/pipermail/freebsd-questions/2003-October/021765.html
>
>
>

In what way does it "not work"?

What does "newsyslog -v -F" say?

Reply | Threaded
Open this post in threaded view
|

Re: how to add squid access log in /etc/newsyslog.conf

Indunil Jayasooriya
Hmm,  thanks for your reply. this is the error.

# newsyslog -v -F

newsyslog: /etc/newsyslog.conf:18: unrecognized field: 30



here's my full file


# cat
/etc/newsyslog.conf

#       $OpenBSD: newsyslog.conf,v 1.29 2011/04/14 20:32:34 sthen Exp $
#
# configuration file for newsyslog
#
# logfile_name          owner:group     mode count size when  flags
/var/cron/log           root:wheel      600  3     10   *     Z
/var/log/aculog         uucp:dialer     660  7     *    24    Z
/var/log/authlog        root:wheel      640  7     *    168   Z
/var/log/daemon                         640  5     30   *     Z
/var/log/lpd-errs                       640  7     10   *     Z
/var/log/maillog                        600  4     *    $M1D0 Z
/var/log/messages                       644  4     *    $M1D0 Z
/var/log/secure                         600  7     *    168   Z
/var/log/wtmp                           644  7     *    $W6D4 B
/var/log/xferlog                        640  7     250  *     Z
/var/log/ppp.log                        640  7     250  *     Z
/var/log/pflog                          600  3     250  *     ZB "pkill
-HUP -u root -U root -t - -x pflogd"
/var/squid/logs/access.log      _squid:_squid   640     14      *
@T00    Z       /var/squid/logs/squid.pid       30


any help to correct it.



On Mon, Jul 13, 2015 at 4:01 PM, Stuart Henderson <[hidden email]>
wrote:

> On 2015-07-13, Indunil Jayasooriya <[hidden email]> wrote:
> > Hi mics,
> >
> >
> > I want /etc/newsyslog.conf to generate /var/squid/logs/access.log  daily.
> > This is the entry I have added to /etc/newsyslog.conf file. But it does
> NOT
> > work.
> >
> > */var/squid/logs/access.log      _squid:_squid   640     14      *
> > @T00    Z       /var/squid/logs/squid.pid       30*
> >
> >
> > any comments ?
> >
> >
> > I referred to below urls
> >
> > http://jamesoff.net/site/reference/squid-log-rotation-with-newsyslog/
> >
> >
> http://lists.freebsd.org/pipermail/freebsd-questions/2007-July/154219.html
> >
> >
> http://lists.freebsd.org/pipermail/freebsd-questions/2003-October/021765.html
> >
> >
> >
>
> In what way does it "not work"?
>
> What does "newsyslog -v -F" say?
>
>


--
cat /etc/motd

Thank you
Indunil Jayasooriya
http://www.theravadanet.net/
http://www.siyabas.lk/sinhala_how_to_install.html   -  Download Sinhala
Fonts

Reply | Threaded
Open this post in threaded view
|

Re: how to add squid access log in /etc/newsyslog.conf

Craig Skinner-3
In reply to this post by Indunil Jayasooriya
On 2015-07-13 Mon 13:25 PM |, Indunil Jayasooriya wrote:

> Hi mics,
>
>
> I want /etc/newsyslog.conf to generate /var/squid/logs/access.log  daily.
> This is the entry I have added to /etc/newsyslog.conf file. But it does NOT
> work.
>
> */var/squid/logs/access.log      _squid:_squid   640     14      *
> @T00    Z       /var/squid/logs/squid.pid       30*
>
>
> any comments ?
>

Squid can rotate its own logs.

Search for 'rotate' in squid(8) and 'logfile_rotate' in
/usr/local/share/examples/squid/squid.conf.documented
Which says: "It is best to get in the habit of using
'squid -k rotate' instead of 'kill -USR1 <pid>'"

I use a monthly _squid cron job like this:


# ---------------------- 8< --------------------------

# crontab(5) ENVIRONMENT
# PATH (& umask) defined in /etc/login.conf
MAILTO=webmaster
                # ENVIRONMENT debug:
# * * * * * logname; umask; pwd; printenv | sort
@monthly nice -n 20 squid -k rotate || print $?

# ---------------------- 8< --------------------------


Edit _squid's crontab with:

$ sudo su -l -s /bin/sh _squid -c 'crontab -e'

Cheers.
--
Drugs may be the road to nowhere, but at least they're the scenic route!

Reply | Threaded
Open this post in threaded view
|

Re: how to add squid access log in /etc/newsyslog.conf

Indunil Jayasooriya
I delted 30 from that line. Now it looks like this.

/var/squid/logs/access.log      _squid:_squid   640     14      *
@T00    Z       /var/squid/logs/squid.pid

Now it seems to work

# newsyslog -v -F
/var/cron/log <3Z>: size (KB): 664.08 [10] --> trimming log....
/var/log/authlog <7Z>: age (hr): 435 [168] --> trimming log....
/var/log/daemon <5Z>: size (KB): 26.76 [30] --> trimming log....
/var/log/lpd-errs <7Z>: size (KB): 0.00 [10] --> trimming log....
/var/log/maillog <4Z>: --> trimming log....
/var/log/messages <4Z>: --> trimming log....
/var/log/secure <7Z>: age (hr): 461 [168] --> trimming log....
/var/log/wtmp <7B>: --> trimming log....
/var/log/xferlog <7Z>: size (KB): 0.00 [250] --> trimming log....
/var/log/pflog <3ZB>: size (KB): 1557278.09 [250] --> trimming log....
/var/squid/logs/access.log <14Z>: --> trimming log....




Now I have 2 files in this way.


-rw-r-----  1 _squid  _squid       28668 Jul 13 16:27 access.log
-rw-r-----  1 _squid  _squid    56380324 Jul 13 16:24 access.log.0.gz

Let's see tomorrow morning,



On Mon, Jul 13, 2015 at 4:24 PM, Craig Skinner <[hidden email]>
wrote:

> On 2015-07-13 Mon 13:25 PM |, Indunil Jayasooriya wrote:
> > Hi mics,
> >
> >
> > I want /etc/newsyslog.conf to generate /var/squid/logs/access.log  daily.
> > This is the entry I have added to /etc/newsyslog.conf file. But it does
> NOT
> > work.
> >
> > */var/squid/logs/access.log      _squid:_squid   640     14      *
> > @T00    Z       /var/squid/logs/squid.pid       30*
> >
> >
> > any comments ?
> >
>
> Squid can rotate its own logs.
>
> Search for 'rotate' in squid(8) and 'logfile_rotate' in
> /usr/local/share/examples/squid/squid.conf.documented
> Which says: "It is best to get in the habit of using
> 'squid -k rotate' instead of 'kill -USR1 <pid>'"
>
> I use a monthly _squid cron job like this:
>
>
> # ---------------------- 8< --------------------------
>
> # crontab(5) ENVIRONMENT
> # PATH (& umask) defined in /etc/login.conf
> MAILTO=webmaster
>                 # ENVIRONMENT debug:
> # * * * * *     logname; umask; pwd; printenv | sort
> @monthly        nice -n 20 squid -k rotate || print $?
>
> # ---------------------- 8< --------------------------
>
>
> Edit _squid's crontab with:
>
> $ sudo su -l -s /bin/sh _squid -c 'crontab -e'
>
> Cheers.
> --
> Drugs may be the road to nowhere, but at least they're the scenic route!
>
>


--
cat /etc/motd

Thank you
Indunil Jayasooriya
http://www.theravadanet.net/
http://www.siyabas.lk/sinhala_how_to_install.html   -  Download Sinhala
Fonts

Reply | Threaded
Open this post in threaded view
|

Re: how to add squid access log in /etc/newsyslog.conf

Stuart Henderson
In reply to this post by Indunil Jayasooriya
On 2015/07/13 16:20, Indunil Jayasooriya wrote:

>
> Hmm,  thanks for your reply. this is the error.
>
> # newsyslog -v -F
>
> newsyslog: /etc/newsyslog.conf:18: unrecognized field: 30
>
>
>
> here's my full file
>
>
> # cat /etc/
> newsyslog.conf                                                                                                                                             
> #       $OpenBSD: newsyslog.conf,v 1.29 2011/04/14 20:32:34 sthen Exp $
> #
> # configuration file for newsyslog
> #
> # logfile_name          owner:group     mode count size when  flags
> /var/cron/log           root:wheel      600  3     10   *     Z
> /var/log/aculog         uucp:dialer     660  7     *    24    Z
> /var/log/authlog        root:wheel      640  7     *    168   Z
> /var/log/daemon                         640  5     30   *     Z
> /var/log/lpd-errs                       640  7     10   *     Z
> /var/log/maillog                        600  4     *    $M1D0 Z
> /var/log/messages                       644  4     *    $M1D0 Z
> /var/log/secure                         600  7     *    168   Z
> /var/log/wtmp                           644  7     *    $W6D4 B
> /var/log/xferlog                        640  7     250  *     Z
> /var/log/ppp.log                        640  7     250  *     Z
> /var/log/pflog                          600  3     250  *     ZB "pkill
> -HUP -u root -U root -t - -x pflogd"
> /var/squid/logs/access.log      _squid:_squid   640     14      *      
> @T00    Z       /var/squid/logs/squid.pid       30
>
>
> any help to correct it.

"man syslog.conf" says this:

     signal            Specify the signal to send to the process instead of
                       SIGHUP.  Signal names must start with “SIG” and be the
                       signal name, not the number, e.g., SIGUSR1.

So it looks like you need to use a name, not the number 30.

Reply | Threaded
Open this post in threaded view
|

Re: how to add squid access log in /etc/newsyslog.conf

Stuart Henderson
In reply to this post by Indunil Jayasooriya
On 2015-07-13, Indunil Jayasooriya <[hidden email]> wrote:
> I delted 30 from that line. Now it looks like this.
>
> /var/squid/logs/access.log      _squid:_squid   640     14      *
> @T00    Z       /var/squid/logs/squid.pid
>
> Now it seems to work

But now it sends the default signal which is HUP. In Squid, this drains
existing connections and reloads the configuration, blocking new connections
while that occurs. You probably want USR1.

Reply | Threaded
Open this post in threaded view
|

Re: how to add squid access log in /etc/newsyslog.conf

Craig Skinner-3
On 2015-07-13 Mon 20:29 PM |, Stuart Henderson wrote:

> On 2015-07-13, Indunil Jayasooriya <[hidden email]> wrote:
> > I delted 30 from that line. Now it looks like this.
> >
> > /var/squid/logs/access.log      _squid:_squid   640     14      *
> > @T00    Z       /var/squid/logs/squid.pid
> >
> > Now it seems to work
>
> But now it sends the default signal which is HUP. In Squid, this drains
> existing connections and reloads the configuration, blocking new connections
> while that occurs. You probably want USR1.
>

On 2015-07-13 Mon 11:54 AM |, Craig Skinner wrote:
> /usr/local/share/examples/squid/squid.conf.documented
> Which says: "It is best to get in the habit of using
> 'squid -k rotate' instead of 'kill -USR1 <pid>'"

Reply | Threaded
Open this post in threaded view
|

Re: how to add squid access log in /etc/newsyslog.conf

Kim Zeitler
In reply to this post by Stuart Henderson
Hello,

On 07/13/15 22:29, Stuart Henderson wrote:
> On 2015-07-13, Indunil Jayasooriya <[hidden email]> wrote:
>> I delted 30 from that line. Now it looks like this.
>>
>> /var/squid/logs/access.log      _squid:_squid   640     14      *
>> @T00    Z       /var/squid/logs/squid.pid
>>
>> Now it seems to work
>

> But now it sends the default signal which is HUP. In Squid, this drains
> existing connections and reloads the configuration, blocking new connections
> while that occurs. You probably want USR1.
>
This is correct, Squid wants a SIGUSR1 as this triggers the
rotate ( like calling squid -k rotate).

You need to configure

logfile_rotate 0

  in the squid.conf. This tells squid to rotate the files but keep itself.

Your newsyslog.conf file should look like this
/var/squid/logs/cache.log _squid:_squid     640  2     250 @T00   ZB
/var/run/squid.pid SIGUSR1

Compared to only using 'squid -k rotate' as Craig suggested, this will
also compress the rotated log files.

Cheerskim

Reply | Threaded
Open this post in threaded view
|

Re: how to add squid access log in /etc/newsyslog.conf

Indunil Jayasooriya
>>  This is correct, Squid wants a SIGUSR1 as this triggers the
> rotate ( like calling squid -k rotate).
>
> You need to configure
>
> logfile_rotate 0
>
>  in the squid.conf. This tells squid to rotate the files but keep itself.
>

   Added, Thank you.



--
cat /etc/motd

Thank you
Indunil Jayasooriya
http://www.theravadanet.net/
http://www.siyabas.lk/sinhala_how_to_install.html   -  Download Sinhala
Fonts

Reply | Threaded
Open this post in threaded view
|

Re: how to add squid access log in /etc/newsyslog.conf

Indunil Jayasooriya
In reply to this post by Stuart Henderson
Hi Stuart,

Hmm, Thanks a lot once a gain. you help me very often.

Edited. Now, This is the line in /etc/newsyslog.conf

/var/squid/logs/access.log      _squid:_squid   640     14      *
@T00    Z       /var/squid/logs/squid.pid       SIGUSR1

and also

*logfile_rotate 0* in squid.conf file

Now it seems to be OK









On Mon, Jul 13, 2015 at 8:29 PM, Stuart Henderson <[hidden email]>
wrote:

> On 2015-07-13, Indunil Jayasooriya <[hidden email]> wrote:
> > I delted 30 from that line. Now it looks like this.
> >
> > /var/squid/logs/access.log      _squid:_squid   640     14      *
> > @T00    Z       /var/squid/logs/squid.pid
> >
> > Now it seems to work
>
> But now it sends the default signal which is HUP. In Squid, this drains
> existing connections and reloads the configuration, blocking new
> connections
> while that occurs. You probably want USR1.
>
>


--
cat /etc/motd

Thank you
Indunil Jayasooriya
http://www.theravadanet.net/
http://www.siyabas.lk/sinhala_how_to_install.html   -  Download Sinhala
Fonts