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

Add new attribute raw_options to td_agent_source #123

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

opan
Copy link

@opan opan commented Aug 16, 2018

Add capabilities to add an attribute with raw values. This cases will be useful for a plugin like this. The matches attribute, need to receive either [] or {} value.

README.md Outdated
@@ -177,6 +178,21 @@ td_agent_source 'test_in_tail' do
end
```

Use attribute `_raw_options` for attribute that using value such as `Array` or `Hash`. For example when you using [FluentD systemd plugin](https://github.com/reevoo/fluent-plugin-systemd).
Copy link
Member

Choose a reason for hiding this comment

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

For consistency, please use fluentd or Fluentd, not FluentD

type 'systemd'
tag 'journalctl'
parameters(
matches: [{"_SYSTEMD_UNIT": "syslog.service"}]
Copy link
Member

Choose a reason for hiding this comment

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

Honestly speaking, I'm skeptical if this is so useful. If I understand the situation correctly, just passing the parameter as a String must be sufficient for that purpose.

td_agent_source 'tail_journalctl' do
  ( ... )
  parameters(
    matches: ::JSON.generate([{"_SYSTEMD_UNIT": "syslog.service"}])
    read_from_head: true
  )
end

I know the TdAgent::Helpers.params_to_text isn't well implemented, but this change would make the situation more complicated with very few actual benefit, I think 🤔

Copy link
Author

Choose a reason for hiding this comment

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

Hi, @yyuu thanks for reviewing my PR. I will try your approach and will tell you soon if this works on my case.

Copy link
Author

Choose a reason for hiding this comment

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

Hi, @yyuu so I've been thinking about your approach. But I found a problem when using this method. How can user set this attributes from nodes.json files where we can't use ruby code? This will be okay if the user set the attribute directly in attributes files.

Thanks in advance.

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