Различия
Здесь показаны различия между двумя версиями данной страницы.
Предыдущая версия справа и слева Предыдущая версия Следующая версия | Предыдущая версия Последняя версия Следующая версия справа и слева | ||
wiki:руководство_по_ubuntu_server:служба_доменных_имен:troubleshooting [2012/06/15 16:26] [Тестирование] |
wiki:руководство_по_ubuntu_server:служба_доменных_имен:troubleshooting [2013/02/19 12:40] [Журналирование] |
||
---|---|---|---|
Строка 74: | Строка 74: | ||
====Журналирование==== | ====Журналирование==== | ||
- | BIND9 has a wide variety of logging configuration options available. There are two main options. The channel option configures where logs go, and the category option determines what information to log. | + | BIND9 имеет широкий набор доступных опций настроек журналов. Существуют две основные опции. С помощью опции **channel** указывается где вести журналы, а опция **category** определяет какую информацию писать в журнал. |
- | + | ||
- | If no logging option is configured the default option is: | + | |
+ | Если опции журналов отсутствуют, по умолчанию применяется следующее: | ||
+ | <code> | ||
logging { | logging { | ||
category default { default_syslog; default_debug; }; | category default { default_syslog; default_debug; }; | ||
category unmatched { null; }; | category unmatched { null; }; | ||
}; | }; | ||
+ | </code> | ||
+ | Этот раздел раскрывает как настроить BIND9 посылать отладочные сообщения, связанные с DNS запросами в отдельный файл. | ||
- | This section covers configuring BIND9 to send debug messages related to DNS queries to a separate file. | + | 1. Сначала нам надо настроить канал (channel) для определения в какой файл посылать сообщения. Редактируем /etc/bind/named.conf.local и добавляем следующее: |
- | + | <code> | |
- | First, we need to configure a channel to specify which file to send the messages to. Edit /etc/bind/named.conf.local and add the following: | + | logging { |
- | + | channel query.log { | |
- | logging { | + | file "/var/log/query.log"; |
- | channel query.log { | + | severity debug 3; |
- | file "/var/log/query.log"; | + | }; |
- | severity debug 3; | + | }; |
- | }; | + | </code> |
- | }; | + | 2. Затем настраиваем категорию (category) для отправки всех DNS запросов в файл: |
- | + | <code> | |
- | Next, configure a category to send all DNS queries to the query file: | + | logging { |
- | + | channel query.log { | |
- | logging { | + | file "/var/log/query.log"; |
- | channel query.log { | + | severity debug 3; |
- | file "/var/log/query.log"; | + | }; |
- | severity debug 3; | + | category queries { query.log; }; |
- | }; | + | }; |
- | category queries { query.log; }; | + | </code> |
- | }; | + | <note>Обратите внимание на опцию **debug**, которая может принимать значения от 1 до 3. Если уровень отладки не указан, о умолчанию используется 1.</note> |
- | + | 3. Поскольку сервис **named** запускается от имени **bind**, надо создать файл и сменить ему пользователя: | |
- | Note: the debug option can be set from 1 to 3. If a level isn't specified level 1 is the default. | + | <code> |
- | + | ||
- | Since the named daemon runs as the bind user the /var/log/query.log file must be created and the ownership changed: | + | |
sudo touch /var/log/query.log | sudo touch /var/log/query.log | ||
sudo chown bind /var/log/query.log | sudo chown bind /var/log/query.log | ||
+ | </code> | ||
+ | 4. Перед тем как сервис **named** сможет писать в новый файл журнала нужно изменить профиль AppArmor. Сначала редактируем файл /etc/apparmor.d/usr.sbin.named, добавив: | ||
+ | <code>/var/log/query.log w,</code> | ||
+ | Затем перегружаем профиль: | ||
+ | <code>cat /etc/apparmor.d/usr.sbin.named | sudo apparmor_parser -r</code> | ||
+ | Дополнительную информацию по **AppArmor** смотрите в разделе [[wiki:руководство_по_ubuntu_server:безопасность:apparmor|AppArmor]]. | ||
- | Before named daemon can write to the new log file the AppArmor profile must be updated. First, edit /etc/apparmor.d/usr.sbin.named and add: | + | 5. Теперь перегружаем BIND9 для применения изменений: |
- | + | <code>sudo service bind9 restart</code> | |
- | /var/log/query.log w, | + | |
- | + | ||
- | Next, reload the profile: | + | |
- | + | ||
- | cat /etc/apparmor.d/usr.sbin.named | sudo apparmor_parser -r | + | |
- | + | ||
- | For more information on AppArmor see AppArmor | + | |
- | + | ||
- | Now restart BIND9 for the changes to take effect: | + | |
- | + | ||
- | sudo service bind9 restart | + | |
- | You should see the file /var/log/query.log fill with query information. This is a simple example of the BIND9 logging options. For coverage of advanced options see More Information. | + | Теперь вы можете увидеть файл /var/log/query.log, заполненный информацией о запросах. Это простейший пример использования опций журналирования BIND9. По использованию расширенных опций смотрите раздел [[wiki/руководство_по_ubuntu_server/служба_доменных_имен/references#дополнительная_информация|Дополнительная информация]]. |
---- | ---- |