Установка и настройка сервисов аудита¶
Для вывода логов в удаленный сервис системного журнала (syslog) используется fluent-plugin-remote_syslog — плагин Fluentd.
Настройка плагина по умолчанию:
<match **> @type remote_syslog host 10.120.120.125 port 514 protocol tcp </match>
Чтобы изменить настройку плагина:
Откройте веб-интерфейс развернутого GitLab.
Откройте проект project_k / deployments / <имя региона>.
Перейдите в директорию
config. Если такой директории нет, создайте её.Создайте файл
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>
Создайте новый пайплайн: .
В открывшемся окне добавьте параметры:
KOLLA_ANSIBLE_DEPLOY_ACTION—deploy;KOLLA_ARGS—-t opensearch.
Запустите пайплайн: New pipeline.
Дождитесь завершения выполнения операции.
(Опционально) Убедитесь, что конфигурационный файл 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>