On 2008-11-21, carlopmart <[EMAIL PROTECTED]> wrote:
>
>   Somebody can helps me with rsyslog configuration to use it as a log 
> centralized server?? I am trying several configs without luck, and all 
> examples 
> that I found are related to v3 and nothing about v2 that ships with CentOS or 
> RHEL.
>
>   I am trying to do something like this:
>
>   $template DynFile,"/var/log/rsyslog/%HOSTNAME%/secure"
>   if $source != 'localhost' and $syslogfacility-text == 'authpriv' then 
> -?DynFile
>
>   But this is for version 3 ... and doesn't works ... Any help??

I use:

    #####################################################
    # Log everything to a per host daily logfile        #
    #####################################################
    $template 
DailyPerHostLogs,"/var/log/syslog/%$YEAR%/%$MONTH%/%$DAY%/%HOSTNAME%/messages.log"
    *.* -?DailyPerHostLogs

But this puts everything received in the same "messages.log" file. To split it
like the default messages/secure/maillog/etc.. i would use (completely 
untested):

    #####################################################
    # Log everything to a per host daily logfile        #
    #####################################################
    $template 
Messages,"/var/log/syslog/%$YEAR%/%$MONTH%/%$DAY%/%HOSTNAME%/messages.log"
    *.info;mail.none;authpriv.none;cron.none -?Messages
    $template 
Secure,"/var/log/syslog/%$YEAR%/%$MONTH%/%$DAY%/%HOSTNAME%/secure.log"
    authpriv.*  -?Secure
    $template Cron,"/var/log/syslog/%$YEAR%/%$MONTH%/%$DAY%/%HOSTNAME%/cron.log"
    cron.*  -?Cron
    <etc..>

>   And how can I rotate logs received from remote hosts??

As you see I prefer to split up in per date logs, so I don't
need rotation. But if you remove the /%$YEAR%/%$MONTH%/%$DAY%
from the above, you'll need to rotate, and I think logrotate
should be able to handle that trough /etc/logrotate.d/rsyslog
containing something like:

    /var/log/syslog/*/*.log {
    daily
    rotate 10
    postrotate
        kill -HUP $(cat /var/run/rsyslogd.pid)
    endscript
    }



  -jf

_______________________________________________
rhelv5-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/rhelv5-list

Reply via email to