-
Notifications
You must be signed in to change notification settings - Fork 6
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
nested message field in message field gets lost when overlaying parsed message #9
Comments
Hello, It looks like you want to set
Hope this fixes your issue. |
That isn't what I need, that'd presumably keep the 'message' block for all events even if the nested value included a The key being kept is the one from the object inside the message, not the original message itself. |
I now see what you're saying. This might be a bug. |
Could be that https://github.com/vanilla/fluent-plugin-burrow/blob/master/lib/fluent/plugin/filter_burrow.rb#L88-L93 is moved before the merger. It still means that if you have a nested key you might overwrite the original value, but not sure theres anything that can be done about that if def filter(tag, time, record)
raw_value = record[@key_name]
if raw_value then
new_time, new_values = nil, nil
@parser.parse(raw_value) do |parsed_time, parsed_values|
new_time = parsed_time
new_values = parsed_values
end
if new_values then
original_time = record[@record_time_key]
new_time ||= original_time
# Remove the key before we merge the new values in case the merger re-creates the key
if ['overlay','replace','prefix'].include? @action
if not @keep_key and record.has_key?(@key_name)
record.delete(@key_name)
end
end
# Overlay new record on top of original record?
new_record = case @action
when 'inplace'
record.merge({@key_name => new_values})
when 'overlay'
record.merge(new_values)
when 'replace'
new_values
when 'prefix'
record.merge({@data_prefix => new_values})
end
# Preserve 'time' key?
if @keep_time
new_record[@record_time_key] = original_time
end
new_record
end
end
end |
Given a json structured rsyslog event which has a field named
message
which includes a jsonformatted json string from an application.And fluent configuration such that the
message
field from rsyslog is parsed as json and overlayed over the original event.When an event is emitted by an app which includes
message
as part of its log,Then the burrow plugin parses the json, overlays it onto the main record but removes the `message field (which was parsed out of the message.
Rsyslog Configuration
FluentD Configuration
Python Test Code
Results
Fluent logs show (Formatted json for readability);
which includes the
message
from rsyslog, and the json formatted string.Once it parses the event we then get
Which does not include the
message
key anymore.Expected
The
message
key from the origin event is replaced with themessage
key parsed from the json-string the origin record contained.The text was updated successfully, but these errors were encountered: