Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KV - Add option to add properties to targetField instead of completely override it #316

Open
deepforest opened this issue Nov 14, 2023 · 0 comments

Comments

@deepforest
Copy link

deepforest commented Nov 14, 2023

Given a 'kv' processor, It's kind of essential to be able to add matching keys to the targetField, if exists, instead of completely override it.
For example:

{
    "kv": {
      "config": {
        "field": "kv",
        "fieldSplit": "\\|#",
        "includeKeys": [
          "key1",
          "key2",
          "key3"
        ],
        "targetField": "@params",
        "targetFieldMergeStrategy": "Replace" | "Concat" <-- suggestion
      }
    }
}

In the example above, given a log such as:

{
  ...
  "message": "My log message|#key1=value1|#key2=value2|#key3=value3",
  "@params":
    "my": "param"
}

the final result shoud be:

{
  ...
  "message": "My log message|#key1=value1|#key2=value2|#key3=value3",
  "@params":
    "my": "param",
    "key1": "value1",
    "key2": "value2",
    "key3": "value3"
}

currently we are getting:

{
  ...
  "message": "My log message|#key1=value1|#key2=value2|#key3=value3",
  "@params":
    "key1": "value1",
    "key2": "value2",
    "key3": "value3"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant