loggie-io / loggie

A lightweight, cloud-native data transfer agent and aggregator
https://loggie-io.github.io/docs-en/
Apache License 2.0
1.26k stars 167 forks source link

fix:fix globalWatcher is nil,when source is enable #648

Closed LeiZhang-Hunter closed 1 year ago

LeiZhang-Hunter commented 1 year ago

Proposed Changes:

Which issue(s) this PR fixes:

pipelines:
  - name: local
    sources:
      - type: file
        enabled: false
        name: demo
        paths:
          - /home/zhanglei/*.log
        fields:
          "@topic": "loggie"
    interceptors:
      - type: normalize
        name: global
        processors:
          - addMeta: ~
          - add:
              fields:
                "metadata.module": "loggie"
                "metadata.type": ""
                "metadata.version": 1.444
          - rename:
              convert:
                - from: "meta.systemState.collectTime"
                  to: "colleciton.@collectiontime"
                - from: "body"
                  to: "collection.@message"
                - from: "meta.systemState.filename"
                  to: "collection.@path"
                - from: "meta.systemState.lineNumber"
                  to: "collection.@rownumber"
          - drop:
              targets: ["meta"]

    sink:
      #      type: dev
      #      printEvents: true
      #      codec:
      #        pretty: true
      type: router
      hosts:
        - "192.168.110.117:7070"
      max_client: 1

Fixes #

if globalWatcher == nil {
        return watcherMetrics
}

Additional documentation:

LeiZhang-Hunter commented 1 year ago

fix globalWatcher is nil