如何在 rsyslog 中为绑定服务创建单独的日志文件?

如何在 rsyslog 中为绑定服务创建单独的日志文件?

我在 ubuntu12.04 上安装了 bind9 作为名称服务。现在来调试其名称解析中的错误。

我需要为它创建单独的日志文件,就像这样/var/log/name.log。我搜索了太多关于 rsyslog 的内容,但随着搜索的深入,我混淆了配置。

如何通过 rsyslog 为绑定服务创建单独的日志文件?

答案1

为了分离 bind9 服务日志文件,只需在文件中添加以下logging部分:name.conf.local

logging {
channel default_file {
    file "/var/log/named/default.log" versions 5 size 5m;
    severity notice;
    print-severity yes;
    print-time yes;
};
channel general_file {
    file "/var/log/named/general.log" versions 3 size 5m;
    severity dynamic; //notice;
    print-severity yes;
    print-time yes;
};
channel database_file {
    file "/var/log/named/database.log" versions 3 size 5m;
    severity dynamic;
    print-severity yes;
    print-time yes;
};
channel queries_file {
    file "/var/log/named/queries.log" versions 3 size 5m;
    severity dynamic;
    print-severity yes;
    print-time yes;
};
channel client_file {
    file "/var/log/named/client.log" versions 3 size 5m;
    severity dynamic;
    print-severity yes;
    print-time yes;
};
channel resolver_file {
    file "/var/log/named/resolver.log" versions 3 size 5m;
    severity dynamic;
    print-severity yes;
    print-time yes;
};
channel security_file {
    file "/var/log/named/security.log" versions 3 size 10m;
    severity dynamic;
    print-time yes;
};
category security { security_file; };
category default{ default_file;  };
category general { general_file; };
category database { database_file; };
};

这里描述本节中每个单词的含义。

相关内容