dpc-sdp / tide_logs
SumoLogic OTel 收集器的日志转发器。
2.0.0
2023-11-17 01:24 UTC
Requires
- drupal/lagoon_logs: ^2.1
This package is auto-updated.
Last update: 2024-09-24 02:45:10 UTC
README
为Monolog提供SumoLogic处理器。
需求
还依赖于以下模块
- admin audit trail - 可审计的事件被发送到Drupal日志中
激活
- 该模块需要一个可工作的Sumo Logic OTEL 收集器,并将日志发送到该收集器。
- 已在此处创建了一个helm图表,以便在Kubernetes集群上轻松安装。
- 要本地测试,在测试项目中
- 在
.docker/sumologic-otel/config.yaml
文件中创建以下内容的文件extensions: sumologic: # Get from https://service.au.sumologic.com/ui/#/security/installation-tokens install_token: <collector-install-token> # Highly recommend adding a unique suffix, otherwise you might run into conflicts with other collector instances. collector_name: SDP Syslog - OTEL - <random-suffix> clobber: true receivers: udplog: listen_address: "0.0.0.0:514" attributes: source_name: "foobar/otel/test" operators: - type: json_parser - type: metadata id: metadata/source_host if: '"source_host" in $$body' attributes: source_host: 'EXPR($$body.source_host)' - type: metadata id: metadata/source_category if: '"source_category" in $$body' attributes: source_category: 'EXPR($$body.source_category)' processors: {} exporters: logging: loglevel: debug sumologic: auth: authenticator: sumologic source_category: "%{source_category}" source_name: "%{source_name}" source_host: "%{source_host}" metadata_attributes: - source.* service: extensions: [sumologic] pipelines: logs: receivers: [udplog] exporters: [sumologic]
- 按以下方式向
docker-compose.yml
中添加服务sumo-otel: image: "public.ecr.aws/sumologic/sumologic-otel-collector:${SUMO_OTEL_RELEASE_VERSION:-0.47.0-sumo-0}" volumes: - .docker/sumologic-otel:/etc/otel ports: - 514 networks: - amazeeio-network - default labels: lagoon.type: none
- 运行
ahoy up
将实例注册到Sumo Logic;现在可以开始收集日志。运行docker-compose logs -f sumo-otel
以确保没有错误。最后一行应该是类似以下内容Everything is ready. Begin running and processing data.
- 在
- 启用Tide Logs模块。转到
/admin/config/development/tide_logs
并确保UDPlog host
和UDPlog port
分别对应于服务的名称和在config.yaml
中的端口,如果是使用docker-compose运行的话。模块的默认值是udp://logger.default.svc:5514
(参见默认配置此处)。 - 如果需要不同的类别(默认为
sdp/dev/tide
),也可以设置SUMOLOGIC_CATEGORY
。 - 然后在SumoLogic中可以使用以下搜索查询查看日志
_collector="SDP Syslog - OTEL - <random-suffix>" and _sourceCategory="sdp/dev/tide"
调试
可以通过设置以下配置变量在本地(或在具有drush访问权限的情况下远程)打印一些非常基本的调试消息
drush config:set tide_logs.settings debug 1