fluent-operator icon indicating copy to clipboard operation
fluent-operator copied to clipboard

bug: parser not found

Open kakaNo1 opened this issue 2 years ago • 2 comments

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

kakaNo1 avatar Nov 10 '23 03:11 kakaNo1

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?

wenchajun avatar Nov 23 '23 09:11 wenchajun

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

kakaNo1 avatar Nov 27 '23 02:11 kakaNo1