出力チャネルを使用したRsyslogログの回転

出力チャネルを使用したRsyslogログの回転

Ubuntuでrsyslogd 4.2.0を実行しています。ここで説明されている出力チャネル機能を使用しようとしています。http://www.rsyslog.com/doc/rsyslog_conf_output.html

私の構成の関連部分は次のとおりです。

$outchannel test_rotated,/var/log/test/test.log,1000000,/root/scripts/rotate-test-logs.pl
local0.* :omfile:$test_rotated

ただし、rsyslogは何も拒否し、/var/log/test/test.logも表示されません。この2行を次のように置き換えると:

local0.* /var/log/test/test.log

すべてがうまく動作します(もちろん、ファイルが自動的に回転するわけではありません)。

私は何を見逃していますか?

ベストアンサー1

Ubuntuのマニュアルページ提案構文がないようです。

local0.* :omfile:$test_rotated

あなたがリンクしたサイトはアドバイスを提供します。内容は次のとおりです。

Keep  in  mind  that $outchannel just defines a channel with "name". It
does not activate it.  To do so, you must  use  a  selector  line  (see
below).  That selector line includes the channel name plus an $ sign in
front of it. A sample might be:

       *.* $mychannel

たぶんこれはうまくいくかもしれません:

local0.* $test_rotated

:これは明らかに使用されているバージョンrsyslogとUbuntuのバージョンによって異なります。だから見てあなたのマニュアルページ(man rsyslog.conf)をクリックするか、リンクしたサイトから正しいバージョンを選択してください。

おすすめ記事