Глава 80. Проверка журналов сервисов

Важно

Журналы экземпляра — это не то же самое, что журналы сервисов (менеджера и агентов).

Службы менеджера и агентов в процессе работы могут отправлять друг другу служебные сообщения. Журналирование этих сообщений настраивается в файлах конфигурации менеджера и агента соответственно.

80.1. Просмотр сервисных журналов #

Чтобы посмотреть сервисные журналы:

  1. Подключитесь по SSH к серверу, на котором установлен интересующий вас менеджер или агент.

  2. Если в файле конфигурации не указан параметр log.file, то журнал пишется в стандартный вывод (stdout).

    Если systemd настроен на перехват stdout тех сервисов, которыми он управляет (это настройка по умолчанию), то вы можете использовать journalctl для просмотра журналов сервисов:

    • Для менеджера:

      journalctl -u ppem
      journalctl -fu ppem
    • Для агента:

      journalctl -u ppem-agent
      journalctl -fu ppem-agent

    Подсказка

    Параметр journalctl -f выводит поступающие сообщения.

  3. Если в файле конфигурации указан параметр log.file, то журнал пишется в файл, указанный в log.file.path.

    Вы можете использовать любой инструмент по вашему выбору для просмотра журнала сервисов, например, tail:

    tail -f путь_к_файлу_журнала

80.2. Настройка уровня детализации журналов сервисов #

По умолчанию журналирование сервисов настроено так, чтобы использовать уровень детализации info. Таким образом, в журнал попадают сообщения с уровнем info, warn и error.

Если информации в журналах недостаточно, выполните следующие шаги:

  1. В файлах конфигурации PPEM для менеджера и агентов укажите подходящий уровень журналирования в параметре log.level.

  2. После внесения любых изменений в файлы конфигурации менеджера и агентов, перезапустите соответствующие сервисы:

    • Для менеджера: systemctl restart ppem

    • Для агента: systemctl restart ppem-agent

  3. Снова посмотрите журналы сервисов.

Chapter 80. Checking Service Logs

Important

Do not confuse instance logs with service logs of the manager and agents.

The manager and agent services can send each other service messages during operation. Logging of these messages is configured in the manager and agent configuration files, respectively.

Viewing Service Logs #

To view service logs:

  1. Connect via SSH to the server where the manager or agent of interest is installed.

  2. If the log.file configuration file parameter is not specified, the log is written to the standard output (stdout).

    If systemd is configured to capture stdout of the services it manages (the default configuration), you can use journalctl to view the service logs:

    • For the manager:

      journalctl -u ppem
      journalctl -fu ppem
      

    • For the agent:

      journalctl -u ppem-agent
      journalctl -fu ppem-agent
      

    Tip

    The journalctl -f option outputs the incoming messages.

  3. If the log.file configuration file parameter is specified, the log is written to the file specified in log.file.path.

    You can use any tool of your choice to view the service log, for example, tail:

    tail -f path_to_log_file
    

Configuring Service Logs Level #

By default, the service logging is configured to use the info verbosity level, thus, logging info warn and error messages.

If the log information is insufficient, complete the following steps:

  1. In the PPEM configuration files, set the appropriate log level in the log.level parameter for the manager and agents.

  2. After making any changes to manager and agent configuration files, restart the corresponding services:

    • For the manager: systemctl restart ppem

    • For the agent: systemctl restart ppem-agent

  3. View service logs again.

FAQ