Skip to content
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

fix to raise error if injected hostname_key is also specified in buffer chunk key #1357

Merged
merged 1 commit into from
Dec 10, 2016

Conversation

tagomoris
Copy link
Member

@tagomoris tagomoris commented Dec 8, 2016

Inject plugin helper does record.dup, so that Output plugin code cannot find any
side effect of inject plugin helper. It means output cannnot do chunking with injected values.

On the other hand, there is just few good use cases about chunking with injected hostname.

  • chunking hostname (just after injected) is to route events with hostname... and hostname is unique on a host
  • just one good use-case, to extract hostname into ${hostname} in configured values
    • but it can be done by ruby code eval

This fixes #1353.

@tagomoris
Copy link
Member Author

@repeatedly could you review this?

# don't have any side effect in chunking of output plugin.
if self.buffer_config.chunk_keys.include?(@_inject_hostname_key)
log.error "Use filters to inject hostname to use it in buffer chunking."
raise Fluent::ConfigError, "the key specified in 'hostname_key' cannot be used in buffering chunk key."
Copy link
Member

Choose a reason for hiding this comment

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

the key specified in 'hostname_key' of <inject> is better.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm, the key specified by 'hostname_key' in <inject> sounds correct.

@tagomoris tagomoris self-assigned this Dec 8, 2016
@repeatedly
Copy link
Member

Others LGTM

@tagomoris tagomoris force-pushed the fix-chunking-with-inject-result branch from 41452d4 to ffdb371 Compare December 8, 2016 12:25
@tagomoris
Copy link
Member Author

Pushed the fixed commit.

…er chunk key

Inject plugin helper does record.dup, so that Output plugin code cannot find any
side effect of inject plugin helper. It means output cannnot do chunking with injected values.
On the other hand, there is just few good use cases about chunking with injected hostname.
* chunking hostname (just after injected) is to route events with hostname... and hostname is unique on a host
* just one good use-case, to extract hostname into ${hostname} in configured values
  * but it can be done by ruby code eval
@tagomoris tagomoris force-pushed the fix-chunking-with-inject-result branch from ffdb371 to c6d29cb Compare December 9, 2016 02:27
@tagomoris tagomoris merged commit 48ffcf6 into master Dec 10, 2016
@tagomoris tagomoris deleted the fix-chunking-with-inject-result branch December 10, 2016 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

extract_placeholders cannot extract ${hostname} properly
2 participants