parallels-cookbooks / cookbook-logstash-forwarder Goto Github PK
View Code? Open in Web Editor NEWChef cookbook with LWRPs for install and managing logstash-forwarder.
Chef cookbook with LWRPs for install and managing logstash-forwarder.
can you fix this issue?
[2015-07-02T10:00:59+00:00] WARN: Using an LWRP by its name (LogstashForwarder) directly is no longer supported in Chef 13 and will be removed. Use Chef::Resource.resource_for_node(node, name) instead.
When running chef with cookbook version 0.2.1, the chef run fails with the following error:
undefined method `provides' for #Class:0x000000045b6540
/var/cache/chef/cookbooks/logstash-forwarder/providers/default.rb:9:in `class_from_file'
/var/cache/chef/cookbooks/logstash-forwarder/providers/default.rb:
2: # Cookbook Name:: logstash-forwarder
3: # Provider:: log_forward
4: # Author:: Kirill Kouznetsov [email protected]
5: #
6: # Copyright (c) 2015, Parallels IP Holdings GmbH
7: #
8:
9>> provides :log_forward
10:
11: use_inline_resources if defined?(use_inline_resources)
12:
13: action :create do
14: end
15:
You created and published on supermarket this cookbook 2 weeks ago.
But there is already a living logstash_forwarder cookbook for almost a year on Chef supermarket (ok the '_' in the name is not very good .. but that's not a problem) :
What are the goals and the differences with the existing one that leads you to write "yet-another-cookbook-for-**" ...
Maybe the first one was not good enough ? But why not trying to PR ?
Can you explain to the community your motivations ?
Thanks ! ๐
I am unable to get this recipe to work. Version 0.2.2 with Chef 11.10. It fails with the following error:
ArgumentError
-------------
wrong number of arguments (1 for 0)
Cookbook Trace:
---------------
/var/lib/aws/opsworks/cache.stage2/cookbooks/logstash-forwarder/resources/default.rb:9:in `class_from_file'
Relevant File Content:
----------------------
/var/lib/aws/opsworks/cache.stage2/cookbooks/logstash-forwarder/
resources/default.rb:
2: # Cookbook Name:: logstash-forwarder
3: # Resource:: log_forward
4: # Author:: ******************
5: #
6: # Copyright (c) 2015, Parallels IP Holdings GmbH
7: #
8:
9>> resource_name :log_forward
10: provides :log_forward
11:
12: actions :create
13: default_action :create
14:
15: attribute :paths, kind_of: Array, required: true
16: attribute :fields, kind_of: Hash, default: {}, required: true
I have tried to use your cookbook like this:
node.set['logstash-forwarder']['logstash_servers'] = ['127.0.0.1:5043']
include_recipe 'logstash-forwarder'
log_forward 'nginx' do
paths ['/var/log/nginx/access.log', '/var/log/nginx/error.log']
fields types: 'nginx'
end
log_forward 'syslog' do
paths ['/var/log/messages']
fields types: 'syslog'
end
but it does not find the lwrp:
[2015-07-02T11:33:34+00:00] WARN: Using an LWRP by its name (LogstashForwarder) directly is no longer supported in Chef 13 and will be removed. Use Chef::Resource.resource_for_node(node, name) instead.
- execute the ruby block get log_forward resources
- update content in file /etc/logstash-forwarder.conf from 4ae3d6 to 34c23b
--- /etc/logstash-forwarder.conf 2015-07-02 11:30:34.598356221 +0000
@@ -6,6 +6,6 @@
"timeout": 15
},
- "files": [{"paths":["/var/log/messages"],"fields":{"types":"syslog"}}]
+ "files": [{"paths":["/var/log/nginx/access.log","/var/log/nginx/error.log"],"fields":{"types":"nginx"}},{"paths":["/var/log/messages"],"fields":{"types":"syslog"}}]
(up to date)
(up to date)
Recipe: asy-logstash::default
================================================================================
Error executing action `create` on resource 'log_forward[nginx]'
================================================================================
ArgumentError
-------------
Cannot find a provider for log_forward[nginx] on ubuntu version 14.04
Resource Declaration:
---------------------
# In /tmp/kitchen/cookbooks/asy-logstash/recipes/default.rb
44: log_forward 'nginx' do
45: paths ['/var/log/nginx/access.log', '/var/log/nginx/error.log']
46: fields types: 'nginx'
47: end
48:
------------------
# Declared in /tmp/kitchen/cookbooks/asy-logstash/recipes/default.rb:44:in `from_file'
log_forward("nginx") do
action :create
retries 0
retry_delay 2
default_guard_interpreter :default
declared_type :log_forward
cookbook_name :"asy-logstash"
recipe_name "default"
paths ["/var/log/nginx/access.log", "/var/log/nginx/error.log"]
fields {:types=>"nginx"}
end
Recipe: logstash-forwarder::default
Running handlers:
[2015-07-02T11:33:34+00:00] ERROR: Running exception handlers
Running handlers complete
[2015-07-02T11:33:34+00:00] ERROR: Exception handlers complete
Chef Client failed. 7 resources updated in 17.087332162 seconds
[2015-07-02T11:33:34+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
[2015-07-02T11:33:34+00:00] ERROR: log_forward[nginx] (asy-logstash::default line 44) had an error: ArgumentError: Cannot find a provider for log_forward[nginx] on ubuntu version 14.04
[2015-07-02T11:33:34+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
I'm not sure how much of its elegance would have to be sacrificed, but I think there needs to be an only_if
statement in there somewhere.
I was trying to set up this cookbook on an AWS Opsworks environment but it failed with the following error:
ERROR: Could not read /opt/aws/opsworks/current/merged-cookbooks/logstash-forwarder into a Chef object: undefined method `source_url'
(currently Opsworks running off Chef 11.10.4, Berkshelf 3.2.0)
I just wanted to make you aware of this and it might help other people who might bump into this issue.
I don't know what could be done about it at the moment.
It looks like other cookbooks are having the same issue:
sous-chefs/aws#122
Changing the value of the config_path attribute changes the location to which the config file is written but it does not update the init.d script so the service continues to look for the file in the default location. Either the config path should not be exposed as an attribute (which suggests it is modifiable) or changes to it need to be fully honored. Since I am trying to change it, obviously I prefer the latter.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.