fluent / fluent-operator

Operate Fluent Bit and Fluentd in the Kubernetes way - Previously known as FluentBit Operator
Apache License 2.0
587 stars 250 forks source link

bug: parser not found #986

Open kakaNo1 opened 1 year ago

kakaNo1 commented 1 year ago

Describe the issue

When I create a parser:

kind: Parser
metadata:
  labels:
    owner: xx
  name: json
  namespace: xx
spec:
  json:
    timeFormat: "%Y-%m-%dT%H:%M:%S.%f%z"
    timeKeep: true
    timeKey: "asctime"

The program will follow my name+namespace (md5). Add a new parser in sercret=fluent-bit-config, as follows:

[PARSER]
    Name    json-18d05c21d7896d5de2e35dced7644xxx
    Format    json
    Time_Key    asctime
    Time_Format    %Y-%m-%dT%H:%M:%S.%f%z
    Time_Keep    true

I referenced this in the Filter

apiVersion: fluentbit.fluent.io/v1alpha2
kind: Filter
metadata:
  name: kubernetes
  ...
  - parser:
      keyName: log
      parser: json

However, the collector may have the following errors:

[2023/09/12 07:20:28] [error] [filter:parser:parser.14] requested parser 'json-18d05c21d7896d5de2e35dced7644xxx-18d05c21d7896d5de2e35dced7644xxx-18d05c21d7896d5de2e35dced7644xxx-18d05c21d7896d5de2e35dced7644xxx' not found
[2023/09/12 07:20:28] [error] [filter:parser:parser.14] Invalid 'parser'
[2023/09/12 07:20:28] [error] Failed initialize filter parser.14
[2023/09/12 07:20:28] [error] [engine] filter initialization failed

To Reproduce

But when I add parsers, this error always occurs

Expected behavior

If I add a new parser named test1, there will be test1 namespace (md5) when creating it, instead of test1 namespace(md5)-namespace(md5)-namespace(md5)-namespace(md5)-namespace(md5)..

Your Environment

- Fluent Operator version:  2.4
- Container Runtime:
- Operating system:
- Kernel version:

How did you install fluent operator?

No response

Additional context

No response

wenchajun commented 12 months ago

The md5 suffix will not be added normally. https://github.com/fluent/fluent-operator/blob/master/apis/fluentbit/v1alpha2/plugins/parser/json_types.go How did this come about?

kakaNo1 commented 11 months ago

Can you give me a correct example? I want to use JSON's Parser in the namespace @wenchajun