Skip to content

parse_klog fails if the message contains newlines #1561

@Ilmarii

Description

@Ilmarii

A note for the community

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Problem

The parse_klog function panics if a message contains a newline character. Such messages are expected to be parsed correctly.

VRL Program

.klog = parse_klog!("E1120 21:46:33.051464     777 kuberuntime_manager.go:1341] \"Unhandled Error\" err=<\n\tinit container: not found\n > logger=\"UnhandledError\"")

VRL and/or Vector Version

vector 0.51.1

Debug Output

error[E000]: function call error for "parse_klog" at (8:166): failed parsing klog message
  ┌─ :1:9
  │
1 │ .klog = parse_klog!("E1120 21:46:33.051464     777 kuberuntime_manager.go:1341] \"Unhandled Error\" err=<\n\tinit container: not found\n > logger=\"UnhandledError\"")
  │         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ failed parsing klog message
  │
  = see language documentation at https://vrl.dev
  = try your code in the VRL REPL, learn more at https://vrl.dev/examples

Example

https://playground.vrl.dev/?state=eyJwcm9ncmFtIjoiLmtsb2cgPSBwYXJzZV9rbG9nIShcIkUxMTIwIDIxOjQ2OjMzLjA1MTQ2NCAgICAgNzc3IGt1YmVydW50aW1lX21hbmFnZXIuZ286MTM0MV0gXFxcIlVuaGFuZGxlZCBFcnJvclxcXCIgZXJyPTxcXG5cXHRpbml0IGNvbnRhaW5lcjogbm90IGZvdW5kXFxuID4gbG9nZ2VyPVxcXCJVbmhhbmRsZWRFcnJvclxcXCJcIikiLCJldmVudCI6eyJtZXNzYWdlIjoiSGVsbG8gVlJMIiwiZm9vIjoiZGVsZXRlIG1lIiwiaHR0cF9zdGF0dXMiOiIyMDAiLCJwbG9wbG8iOm51bGx9LCJpc19qc29ubCI6ZmFsc2UsImVycm9yIjpudWxsfQ%3D%3D

Additional Context

No response

References

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions