-
Notifications
You must be signed in to change notification settings - Fork 179
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
to_yaml changes everytime #20
Comments
Does setting the line to |
Thank you for the response. I setting the line to <%= YAML::dump(@filebeat_config) %> is did't work. puppet also change it everytime. I'm not really ruby too .... I have two choice:
|
Puppet 4 ships ruby with it in the packages, so upgrading to puppet 4 is another option to add to the list, though possibly harder than the other 2. I'm looking at options to see how I might be able to make this work on puppet 3.x with Ruby 1.8. |
thx, If you want to compatible puppet 3.x with Ruby 1.8, give up 'to_yaml' ? like : filebeat:
# General filebeat configuration options
#
# Event count spool threshold - forces network flush if exceeded
spool_size: <%= @filebeat_spool_size %> |
That's what I'm thinking - it's just a matter of writing out a rather long template with a lot of options. The fix won't be super quick, but I'm working on it. I'll probably use the existing template when the ruby version is newer than 1.8.7 so that the module is always ready for changes. |
There are enough options that it may not be practical to cover everything until someone needs it. What output options do you consider important to support in the module? How about other sections like run_options or logging? |
Partition to four options ? Third prospector: Fourth output: Second logging: Some as default , Some sa variables ? |
I'm going to try and keep behavior the same, so prospectors end up in a configuration directory as individual files instead of in the main filebeat.yml file. I'll make sure that logging, logstash outputs, and top level options are all there when I push something up. |
Can you try out the ruby_18_template branch to see if that fixes your problems? If it does I'll merge it and release a new version to the forge tomorrow. Thanks for your help! |
ok , I'm going to test. |
Is work ,thx very much ! but there are a few small problems.
# more /etc/filebeat/filebeat.yml
### Filebeat configuration managed by Puppet (Ruby 1.8 version) ###
---
filebeat:
spool_size: 1024
publish_async: false
idle_timeout: 5s
registry_file: .filebeat
config_dir: /etc/filebeat/conf.d
output:
logstash:
hosts:
- 192.168.134.222:6782
- 192.168.134.223:6782
worker: 3
loadbalance: true
logging:
to_syslog: false
to_files: false
files:
path: /var/log/filebeat
name: filebeat.log
keepfiles: 7
level: info
filebeat::prospector { 'syslog':
paths => [
'/var/log/messages',
],
doc_type => 'syslog',
} |
I'll work on the appearance of the file after we've got everything working. Can you give me a little more information about the logging options and prospector issues? I'm not able to replicate either of the issues as I understand them. |
OK |
Did this fix your problem in a way that everything still works? If it does I'll merge this and publish a new release. |
I'm hitting this problem now also, with RHEL6 hosts with puppet 3.8.6. Each puppet run re-orders the filebeat.yml file, calling a filebeat service refresh. |
Looked at your ruby_18_template branch. One thing to note is that all output 'port' values need to be integers. So for example: output: I had to make this change in your master branch also, and convert [output][logstash][port] to integer. (Same with redis output, and I assume same with elasticsearch.) |
I've always defined the port as part of the hostname ( Did everything else work in the ruby_18_template branch? |
I haven't actually tested the branch yet, just looked at it. I'm still early in the investigation of moving from 'beaver' to 'filebeat'. |
Oh ok - let me know if I can help at all. I've tested the ruby 1.8 template in vagrant without any issues, but I want to make sure it actually solves problems (and doesn't create new ones) before I push it up. |
Yes! That's essentially what I introduced on my side, though I forgot to check for port being null. |
Actually, isn't this equivalent to checking if it's not nil?
|
It works the same - I was on autopilot after creating the other template. I wanted to make sure that values that are false were written out to YAML as well, so I was explicitly checking for nil. I've changed it to what you were doing for consistency sake. |
First bug I've run into, after trying the branch:
That is a line in the template about geoips, which I don't set?
|
I was able to make this work by wrapping it in another if checking for geoip:
|
Does this work? <%- if @filebeat_config['shipper']['geoip'] != nil and @filebeat_config['shipper']['geoip']['paths'] != nil -%>
geoip:
paths:
<%- @filebeat_config['shipper']['geoip']['paths'].each do |path| -%>
- <%= path %>
<%- end -%>
<%- end -%> |
Looks like it would. Wrapping it in the larger if block may make more sense if there end up being other options under geoip, however? |
I should have read the docs sooner. It looks like filebeat ignores the geoip settings anyway, so I'm going to remove that chunk. |
Are there any other issues or missing pieces? If everyone is happy with this I'll go ahead and merge it. |
It's working good for me, other than that geoip part. Great! |
I'll push a new release up to the forge on Monday morning Let me know if you find something that needs fixing. |
Thx very much , I take the time to test it again. It's working good for me too. Great! |
So interestingly, I'm trying this on a Mac OS X machine with 10.9.5 and ruby 2.0.0p481, and I'm seeing this problem again. |
What are your |
I did some hacking to get Darwin to work properly. I am confused that it's giving this behavior, with ruby 2.0.0. |
I don't know enough about Ruby to really know why behavior would change. I was more interested in what you kernel fact showed since Darwin should have failed with an error. Is it idempotent if you change the last line in the template to |
I'm not able to replicate this one on Ubuntu with ruby 2.0p484. Did you have any luck? I'm holding back pushing the fix to the forge until we're pretty sure it's not going to create more issues. |
(I've added support for Darwin myself. I'm hopeful I will be able to contribute back up.) For now, I'm treating any Darwin like a ruby1.8.7 host. I'm hopeful when I can move to puppet4, this error will go away. |
Hello, I install filebeat.
Although generating facts.yaml dynamically is definitely something i want ,but Puppet will change it almost everytime .
I search one-blog to fix it . I try to change
<%= @filebeat_config.to_yaml() %>
to<%= @filebeat_config.to_yaml.sort() %>
and any parameters is did't work .some many people encounter this problem. say: "I have the same problem and this is not a bug in the module itself. In the routes.yaml.erb template there's a call to the method 'to_yaml', which in Ruby 1.8.7 is not stable which means the order of the dumped lines is not always the same. In Ruby >=1.9 this is no longer the case.
Unless the module developer's do not want the replace the call to_yaml with something dirty and very hacky for us Ruby 1.8.7 users, we will have to live with this, I'm afraid."
My env :
The text was updated successfully, but these errors were encountered: