Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm moving from a syslog-ng central log host to rsyslog. I can't even seem to find syslog-ng in the CentOS repos these days. I want to filter logs by hostname and facility.

Here is how I do it in syslog-ng

destination std { 
        owner(root) group(root) perm(0600) dir_perm(0700) create_dirs(yes)

Is there a simple way to do this with rsyslog?

share|improve this question
FWIW: syslog-ng is still maintained and can be installed from EPEL. See dl.fedoraproject.org/pub/epel/6/x86_64/repoview/syslog-ng.html. – dartonw Dec 3 '12 at 22:43
up vote 3 down vote accepted

This is done via templates, like this:

$template HostDynFile,"/var/log/HOSTS/%HOSTNAME%/%$YEAR%/%$MONTH%/%$DAY%/%syslogfacility-text%_%HOSTNAME%_%$YEAR%_%$MONTH%_%$DAY%"

This template can then be used when defining an output selector line, e.g.:

*.* -?HostDynFile

More info is available here: Building A Central Loghost On CentOS And RHEL 5 With rsyslog

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.