Skip to content

Add new attribute raw_options to td_agent_source#123

Open
opan wants to merge 3 commits intotreasure-data:masterfrom
BaritoLog:master
Open

Add new attribute raw_options to td_agent_source#123
opan wants to merge 3 commits intotreasure-data:masterfrom
BaritoLog:master

Conversation

@opan
Copy link
Copy Markdown

@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.

Comment thread README.md Outdated
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
Copy Markdown
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

Comment thread README.md
type 'systemd'
tag 'journalctl'
parameters(
matches: [{"_SYSTEMD_UNIT": "syslog.service"}]
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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