dpc-sdp/tide_logs

SumoLogic OTel 收集器的日志转发器。

维护者

详细信息

github.com/dpc-sdp/tide_logs

来源

安装量: 19,748

依赖者: 1

建议者: 0

安全: 0

星标: 0

关注者: 8

分支: 0

类型:drupal-module

2.0.0 2023-11-17 01:24 UTC

This package is auto-updated.

Last update: 2024-09-24 02:45:10 UTC


README

为Monolog提供SumoLogic处理器。

需求

还依赖于以下模块

激活

  1. 该模块需要一个可工作的Sumo Logic OTEL 收集器,并将日志发送到该收集器。
    1. 已在此处创建了一个helm图表,以便在Kubernetes集群上轻松安装。
    2. 要本地测试,在测试项目中
      1. .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]
        
      2. 按以下方式向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
      3. 运行ahoy up将实例注册到Sumo Logic;现在可以开始收集日志。运行docker-compose logs -f sumo-otel以确保没有错误。最后一行应该是类似以下内容
        Everything is ready. Begin running and processing data.
        
  2. 启用Tide Logs模块。转到/admin/config/development/tide_logs并确保UDPlog hostUDPlog port分别对应于服务的名称和在config.yaml中的端口,如果是使用docker-compose运行的话。模块的默认值是udp://logger.default.svc:5514(参见默认配置此处)。
  3. 如果需要不同的类别(默认为sdp/dev/tide),也可以设置SUMOLOGIC_CATEGORY
  4. 然后在SumoLogic中可以使用以下搜索查询查看日志
    _collector="SDP Syslog - OTEL - <random-suffix>" and _sourceCategory="sdp/dev/tide"
    

调试

可以通过设置以下配置变量在本地(或在具有drush访问权限的情况下远程)打印一些非常基本的调试消息

drush config:set tide_logs.settings debug 1