collector

command module
v1.0.4-beta.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 24, 2022 License: BSD-3-Clause Imports: 5 Imported by: 0

README

Weplanx Collector

GitHub go.mod Go version Go Report Card Release GitHub license

日志采集器在 NATS JetStream 基础上订阅匹配与 Transfer 服务相同的命名空间,自动进行配置调度、 日志系统写入

版本 *.*.*elastic-collector 已归档的分支项目 ,请使用 v*.*.* 发布的版本(预发布用于构建测试)

部署服务

消费数据可选择腾讯云 CLS 日志系统写入,通过 CLS 可进行更多自定义,例如:投递至智能分层的 COS 对象存储中替代永久存储等。也支持写入到自定的 influxDB2 时序数据库中。

Collector

镜像源主要有:

  • ghcr.io/weplanx/collector:latest
  • ccr.ccs.tencentyun.com/weplanx/collector:latest(国内)

案例将使用 Kubernetes 部署编排,复制部署内容(需要根据情况做修改):

  1. 设置配置
apiVersion: v1
kind: ConfigMap
metadata:
  name: collector.cfg
data:
  config.yml: |
    namespace: <命名空间>
    nats:
      hosts:
        - "nats://a.nats:4222"
        - "nats://b.nats:4222"
        - "nats://c.nats:4222"
      nkey: "<nkey>"
    log_system:
      # type: "cls"
      # option:
      #  secret_id: <建议创建CLS子用户,https://cloud.tencent.com/document/product/598/13674>
      #   secret_key: 
      #   endpoint: ap-guangzhou.cls.tencentcs.com
      type: "influx"
      option:
        url: http://localhost:8086
        token: <authToken>
        org: 
        bucket: 
  1. 部署
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: collector
  name: collector
spec:
  selector:
    matchLabels:
      app: collector
  template:
    metadata:
      labels:
        app: collector
    spec:
      containers:
        - image: ccr.ccs.tencentyun.com/weplanx/collector:latest
          imagePullPolicy: Always
          name: collector
          volumeMounts:
            - name: config
              mountPath: "/app/config"
              readOnly: true
      volumes:
        - name: config
          configMap:
            name: collector.cfg
            items:
              - key: "config.yml"
                path: "config.yml"

滚动更新

复制模板内容,并需要自行定制触发条件,原理是每次patch将模板中 ${tag} 替换为版本执行

spec:
  template:
    spec:
      containers:
        - image: ccr.ccs.tencentyun.com/weplanx/collector:${tag}
          name: collector

例如:在 Github Actions 中

patch deployment collector --patch "$(sed "s/\${tag}/${{steps.meta.outputs.version}}/" < ./config/patch.yml)"

国内可使用 Coding持续部署云效流水线

License

BSD-3-Clause License

FOSSA Status

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL