Skip to content

Conversation

@jonphilpott
Copy link

No description provided.

end

logger << json_payload + $INPUT_RECORD_SEPARATOR
logger << (prefix.nil? ? "" : prefix) + json_payload + $INPUT_RECORD_SEPARATOR
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefix.to_s will work here since nil.to_s #=> "".

Copy link

@film42 film42 Nov 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might actually be a bit problematic since the expectation is that the output is a pure json blob without any formatting or parsing required.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the idea we were discussing was that prefixing the blob with a prefix would allow us to positively identify logstasher output in a stdout stream without having to fully parse the json

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this break logstash filters that try to parse a json payload?

    filter {
      json {
        source => "message"
      }
    }

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if someone defines a prefix then the logstash pipeline will extract the json string after the prefix to a field and then json parse on that new field.

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

Successfully merging this pull request may close these issues.

2 participants