Add hostname to a configurable field name #27
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Inspired by fluentd in_forward's source_hostname_key, but done on the endpoint
so that in_forward doesn't have to split apart and re-contruct messagepack
record sets, and so the hostname is used instead of an IP address.
This is useful when using Fluentd to send to a centralized logging system like
Graylog that requires a hostname entry for logs.
Note, format="None" logs use a custom Fluent message structure and do not use a
RecordModifier so hostnames are not added there. (I was unsure why there were were multiple implementations of message sending.)
Note, RecordModifier seemed like the best place to put this, given the name of the structure, however, the name of the file, "fileformat.go", implies that it is about parsing file contents, which adding the hostname is not. I could see instead adding this functionality into hydra.go's NewFluentRecordSet, perhaps using helper function that is called after Modify(). I'd be happy to refactor if that is the better place for this.