Установка и настройка сервисов аудита

Для вывода логов в удаленный сервис системного журнала (syslog) используется fluent-plugin-remote_syslog — плагин Fluentd.

Настройка плагина по умолчанию:

<match **>
@type remote_syslog
host 10.120.120.125
port 514
protocol tcp
</match>

Чтобы изменить настройку плагина:

  1. Откройте веб-интерфейс развернутого GitLab.

  2. Откройте проект project_k / deployments / <имя региона>.

  3. Перейдите в директорию config. Если такой директории нет, создайте её.

  4. Создайте файл fluentd/output/fluent-plugin-remote_syslog.conf со следующим содержимым:

    <match <регулярное выражение для фильтрации записей>>
        @type copy
        <store>
            @type opensearch
            host {{ opensearch_address }}
            port {{ opensearch_port }}
            scheme {{ fluentd_opensearch_scheme }}
    {% if fluentd_opensearch_path != '' %}
            path {{ fluentd_opensearch_path }}
    {% endif %}
    {% if fluentd_opensearch_scheme == 'https' %}
            ssl_version {{ fluentd_opensearch_ssl_version }}
            ssl_verify {{ fluentd_opensearch_ssl_verify }}
    {% if fluentd_opensearch_cacert | length > 0 %}
            ca_file {{ fluentd_opensearch_cacert }}
    {% endif %}
    {% endif %}
    {% if fluentd_opensearch_user != '' and fluentd_opensearch_password != ''%}
            user {{ fluentd_opensearch_user }}
            password {{ fluentd_opensearch_password }}
    {% endif %}
            logstash_format true
            logstash_prefix {{ opensearch_log_index_prefix }}
            reconnect_on_error true
            request_timeout {{ fluentd_opensearch_request_timeout }}
            suppress_type_name true
            <buffer>
            @type file
            path /var/lib/fluentd/data/opensearch.buffer/openstack.*
            flush_interval 15s
            </buffer>
        </store>
        <store>
            @type remote_syslog
            host <IP-адрес плагина>
            port <порт плагина>
            protocol <протокол для взаимодействия с плагином>
        </store>
    </match>
    
  5. Создайте новый пайплайн: Build > Pipelines > New Pipeline.

  6. В открывшемся окне добавьте параметры:

    • KOLLA_ANSIBLE_DEPLOY_ACTIONdeploy;

    • KOLLA_ARGS-t opensearch.

  7. Запустите пайплайн: New pipeline.

  8. Дождитесь завершения выполнения операции.

  9. (Опционально) Убедитесь, что конфигурационный файл Fluentd td-agent.conf содержит добавленные данные.

Ниже приведён пример конфигурационного файла OpenSearch для отправки всех данных в сервис syslog по протоколу UDP на IP-адрес 10.10.140.100 и порт 7710:

<match **>
    @type copy
    <store>
        @type opensearch
        host {{ opensearch_address }}
        port {{ opensearch_port }}
        scheme {{ fluentd_opensearch_scheme }}
{% if fluentd_opensearch_path != '' %}
        path {{ fluentd_opensearch_path }}
{% endif %}
{% if fluentd_opensearch_scheme == 'https' %}
        ssl_version {{ fluentd_opensearch_ssl_version }}
        ssl_verify {{ fluentd_opensearch_ssl_verify }}
{% if fluentd_opensearch_cacert | length > 0 %}
        ca_file {{ fluentd_opensearch_cacert }}
{% endif %}
{% endif %}
{% if fluentd_opensearch_user != '' and fluentd_opensearch_password != ''%}
        user {{ fluentd_opensearch_user }}
        password {{ fluentd_opensearch_password }}
{% endif %}
        logstash_format true
        logstash_prefix {{ opensearch_log_index_prefix }}
        reconnect_on_error true
        request_timeout {{ fluentd_opensearch_request_timeout }}
        suppress_type_name true
        <buffer>
        @type file
        path /var/lib/fluentd/data/opensearch.buffer/openstack.*
        flush_interval 15s
        </buffer>
    </store>
    <store>
        @type remote_syslog
        host 10.10.140.100
        port 7710
        protocol udp
    </store>
</match>