Skip to content

new gems are not loaded properly causing td-agent service reload/restart failure #75

@nick-james

Description

@nick-james

When trying to install td-agent together with the fluent-plugin-elasticsearch plugin, the fluent-plugin-elasticsearch is successfully installed, but the initial restart/reload of the server during the install procedure fails - so after the chef-client has run td-agent is not running, but should be. However when the td-agent server is manually restarted following the installation then it starts fine ( which shows the elasticsearch gem was installed and the td-agent config is OK).

Here is the recipe I am running to install td-agent:

# dependency for elasticsearch-fluentd gem for fluentd plugin                                                                                                                                                       
case node['platform_family']
when 'debian'
  package 'libcurl3-dev' do
    action :install
  end
when 'rhel'
  package 'libcurl-devel' do
    action :install
  end
else
  Chef::Log.fatal("platform family #{node['platform_family']} not supported")
end

include_recipe 'td-agent::default'

# Add a listen to http for curl test POSTs                                                                                                                                                                          
td_agent_source 'test_in_http' do
  type 'http'
  params(port: '8080')
end

# Store incoming to elasticsearch                                                                                                                                                                                   
td_agent_match 'test_out_elasticsearch' do
  type 'elasticsearch'
  tag 'test.*'
  params(host: 'localhost',
         port: '9200',
         logstash_format: 'true',
         type_name: 'test_elasticsearch',
         flush_interval: 1)
end

Here are the relevant attributes:

# tell td-agent to use the includes dir                                                                                                                                         
default['td_agent']['includes'] = true

# tell td-agent not to use the default config                                                                                                                                                                       
default['td_agent']['default_config'] = false

default['td_agent']['plugins'] = ['elasticsearch']

I am running this using test kitchen with the latest chef client (12.6.0-1) on ubuntu 14.04

And on the ubuntu 14.04 machine itself this is the output I see from the td-agent server log (all from during chef run):

cat /var/log/td-agent/td-agent.log 
2016-01-28 13:01:57 +0000 [info]: reading config file path="/etc/td-agent/td-agent.conf"
2016-01-28 13:01:57 +0000 [info]: starting fluentd-0.12.19
2016-01-28 13:01:57 +0000 [info]: gem 'fluent-mixin-config-placeholders' version '0.3.0'
2016-01-28 13:01:57 +0000 [info]: gem 'fluent-mixin-plaintextformatter' version '0.2.6'
2016-01-28 13:01:57 +0000 [info]: gem 'fluent-plugin-mongo' version '0.7.11'
2016-01-28 13:01:57 +0000 [info]: gem 'fluent-plugin-rewrite-tag-filter' version '1.5.3'
2016-01-28 13:01:57 +0000 [info]: gem 'fluent-plugin-s3' version '0.6.4'
2016-01-28 13:01:57 +0000 [info]: gem 'fluent-plugin-scribe' version '0.10.14'
2016-01-28 13:01:57 +0000 [info]: gem 'fluent-plugin-td' version '0.10.28'
2016-01-28 13:01:57 +0000 [info]: gem 'fluent-plugin-td-monitoring' version '0.2.1'
2016-01-28 13:01:57 +0000 [info]: gem 'fluent-plugin-webhdfs' version '0.4.1'
2016-01-28 13:01:57 +0000 [info]: gem 'fluentd' version '0.12.19'
2016-01-28 13:01:57 +0000 [info]: using configuration file: <ROOT>
</ROOT>
2016-01-28 13:02:36 +0000 [info]: restarting
2016-01-28 13:02:36 +0000 [info]: reading config file path="/etc/td-agent/td-agent.conf"
2016-01-28 13:02:36 +0000 [info]: shutting down fluentd
2016-01-28 13:02:36 +0000 [info]: process finished code=0
2016-01-28 13:02:36 +0000 [error]: fluentd main process died unexpectedly. restarting.
2016-01-28 13:02:36 +0000 [info]: starting fluentd-0.12.19
2016-01-28 13:02:36 +0000 [info]: gem 'fluent-mixin-config-placeholders' version '0.3.0'
2016-01-28 13:02:36 +0000 [info]: gem 'fluent-mixin-plaintextformatter' version '0.2.6'
2016-01-28 13:02:36 +0000 [info]: gem 'fluent-plugin-mongo' version '0.7.11'
2016-01-28 13:02:36 +0000 [info]: gem 'fluent-plugin-rewrite-tag-filter' version '1.5.3'
2016-01-28 13:02:36 +0000 [info]: gem 'fluent-plugin-s3' version '0.6.4'
2016-01-28 13:02:36 +0000 [info]: gem 'fluent-plugin-scribe' version '0.10.14'
2016-01-28 13:02:36 +0000 [info]: gem 'fluent-plugin-td' version '0.10.28'
2016-01-28 13:02:36 +0000 [info]: gem 'fluent-plugin-td-monitoring' version '0.2.1'
2016-01-28 13:02:36 +0000 [info]: gem 'fluent-plugin-webhdfs' version '0.4.1'
2016-01-28 13:02:36 +0000 [info]: gem 'fluentd' version '0.12.19'
2016-01-28 13:02:36 +0000 [info]: adding match pattern="test.*" type="elasticsearch"
2016-01-28 13:02:36 +0000 [error]: config error file="/etc/td-agent/td-agent.conf" error="Unknown output plugin 'elasticsearch'. Run 'gem search -rd fluent-plugin' to find plugins"
2016-01-28 13:02:36 +0000 [info]: process finished code=256
2016-01-28 13:02:36 +0000 [warn]: process died within 1 second. exit.

td-agent is not running after the chef run:

sudo service td-agent status 
 * td-agent is not running

But if I manually restart it then it works fine:

sudo service td-agent restart
Restarting td-agent:  * td-agent

And there are now no errors in the td-agent log:

2016-01-28 13:10:00 +0000 [info]: reading config file path="/etc/td-agent/td-agent.conf"
2016-01-28 13:10:00 +0000 [info]: starting fluentd-0.12.19
2016-01-28 13:10:00 +0000 [info]: gem 'fluent-mixin-config-placeholders' version '0.3.0'
2016-01-28 13:10:00 +0000 [info]: gem 'fluent-mixin-plaintextformatter' version '0.2.6'
2016-01-28 13:10:00 +0000 [info]: gem 'fluent-plugin-elasticsearch' version '1.3.0'
2016-01-28 13:10:00 +0000 [info]: gem 'fluent-plugin-mongo' version '0.7.11'
2016-01-28 13:10:00 +0000 [info]: gem 'fluent-plugin-rewrite-tag-filter' version '1.5.3'
2016-01-28 13:10:00 +0000 [info]: gem 'fluent-plugin-s3' version '0.6.4'
2016-01-28 13:10:00 +0000 [info]: gem 'fluent-plugin-scribe' version '0.10.14'
2016-01-28 13:10:00 +0000 [info]: gem 'fluent-plugin-td' version '0.10.28'
2016-01-28 13:10:00 +0000 [info]: gem 'fluent-plugin-td-monitoring' version '0.2.1'
2016-01-28 13:10:00 +0000 [info]: gem 'fluent-plugin-webhdfs' version '0.4.1'
2016-01-28 13:10:00 +0000 [info]: gem 'fluentd' version '0.12.19'
2016-01-28 13:10:00 +0000 [info]: adding match pattern="test.*" type="elasticsearch"
2016-01-28 13:10:00 +0000 [info]: adding source type="http"
2016-01-28 13:10:00 +0000 [info]: using configuration file: <ROOT>
  <source>
    type http
    port 8080
  </source>
  <match test.*>
    type elasticsearch
    host localhost
    port 9200
    logstash_format true
    type_name test_elasticsearch
    flush_interval 1
  </match>
</ROOT>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions