-
Notifications
You must be signed in to change notification settings - Fork 23
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
avoiding overwriting of tags with key named as 'tags' #10
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,7 +40,8 @@ def decode(data, &block) | |
end # def decode | ||
|
||
def encode(event) | ||
tag = event.get("tags") || "log" | ||
tag = event.get("tags") || "log" | ||
|
||
epochtime = event.timestamp.to_i | ||
|
||
# use normalize to make sure returned Hash is pure Ruby for | ||
|
@@ -70,31 +71,34 @@ def decode_event(data, &block) | |
entries_decoder.feed_each(entries) do |entry| | ||
epochtime = entry[0] | ||
map = entry[1] | ||
event = LogStash::Event.new(map.merge( | ||
arr= [] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please try to follow the core conventions present in this file. when assigning to a variable, we use spaces before and after the equals sign, so There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mad the changes. Thanks for Notifying |
||
event = LogStash::Event.new(map.merge!( | ||
LogStash::Event::TIMESTAMP => LogStash::Timestamp.at(epochtime), | ||
"tags" => [ tag ] | ||
)) | ||
"tags" => tag | ||
){ |key, v1, v2| arr.insert(0,v2,v1) }) | ||
yield event | ||
end | ||
when Array | ||
# Forward | ||
entries.each do |entry| | ||
epochtime = entry[0] | ||
map = entry[1] | ||
event = LogStash::Event.new(map.merge( | ||
arr= [] | ||
event = LogStash::Event.new(map.merge!( | ||
LogStash::Event::TIMESTAMP => LogStash::Timestamp.at(epochtime), | ||
"tags" => [ tag ] | ||
)) | ||
"tags" => tag | ||
){ |key, v1, v2| arr.insert(0,v2,v1) }) | ||
yield event | ||
end | ||
when Fixnum | ||
# Message | ||
epochtime = entries | ||
map = data[2] | ||
event = LogStash::Event.new(map.merge( | ||
arr = [] | ||
event = LogStash::Event.new(map.merge!( | ||
LogStash::Event::TIMESTAMP => LogStash::Timestamp.at(epochtime), | ||
"tags" => [ tag ] | ||
)) | ||
"tags" => tag | ||
){ |key, v1, v2| arr.insert(0,v2,v1) }) | ||
yield event | ||
else | ||
raise(LogStash::Error, "Unknown event type") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove this indentation changes, this will make the PR less noisy and more concise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah i completed that. Thanks for notifying