The logging statement configures a wide variety of logging options for the name server.
Its channel phrase associates output methods, format options and severity levels with a name that can then be used with the category phrase to select how various classes of messages are logged.

以上中文自譯…可以使用logging、channel、category的選項可以用來設定DNS輸出日誌時的方法、格式還有訊息等級…等等的用途

從官方文件的內容可以得到更詳細的內容…
http://oldwww.isc.org/sw/bind/arm95/Bv9ARM.ch06.html#id2575011

底下稍微記錄一下使用的方法…相關的實作測試就交給你們自己~
還有…此篇需要對Linux的日誌管理方式有初步認識

logging Statement Grammar (格式語法取自官方說明文件)

logging {
   [ channel channel_name {
     ( file path_name
         [ versions ( number | unlimited ) ]
         [ size size spec ]
       | syslog syslog_facility
       | stderr
       | null );
     [ severity (critical | error | warning | notice |
                 info | debug [ level ] | dynamic ); ]
     [ print-category yes or no; ]
     [ print-severity yes or no; ]
     [ print-time yes or no; ]
   }; ]
   [ category category_name {
     channel_name ; [ channel_name ; ... ]
   }; ]
   ...
};

範例1:
logging {
channel sec_file {
file "/var/log/bind_security.log" versions 3 size 20m;
severity debug 3;
print-time yes;
print-category yes;
print-severity yes;
};
};


說明:
file 為定義輸出到何檔案?
version 3 為保留3份舊的檔案(如指定version unlimited,則保留份數無上限)
size 20m 為到達大小時產生新的檔案(如沒指定…預設大小無)
print-category yes 把類別順便輸出
print-severity yes 把訊息等級順便輸出
print-time yes 把time stamp順便輸出
 
範例2:
logging {


channel default_syslog {
syslog daemon;
severity info;
};


channel null {
file "/dev/null";
};
};
說明:
此為定義兩個channel(channel可有多個在logging區段中)

 
 
範例3:

logging {
channel "my_security_channel" {
file "/var/log/bind_security.log";
severity info;
};
channel default_syslog {
syslog daemon;
severity info;
};
category "security" {
"my_security_channel";
"default_syslog";
};
};
說明:
訊息會產生到/var/log/bind_security.log,但保留預設syslog daemon的訊息動作
arrow
arrow
    全站熱搜
    創作者介紹
    創作者 creative1223 的頭像
    creative1223

    小蘇的世界

    creative1223 發表在 痞客邦 留言(0) 人氣()