small-ops 0.0.19 → 0.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,19 +13,25 @@ OptionParser.new do |opts|
13
13
  opts.on("-t", "--target container", "Set container to use with logstash") do |t|
14
14
  @options[:target] = t
15
15
  end
16
+ opts.on("-l", "--logstash host:port", "Set host:port where is logstash") do |l|
17
+ @options[:logstash] = l
18
+ end
16
19
  opts.on("-f","--foreground","Keep running on foregroud. Default is run once and exit.") do |f|
17
20
  @options[:foreground]=f
18
21
  end
19
22
  end.parse!
20
23
 
21
- data = http_get("#{@options[:etcd]}/v2/keys/logstash/networksettings?recursive=true")
22
-
23
- final = eflatten( data["node"] )
24
- logstash = "#{final["logstash_networksettings_ipaddress"]}:514"
25
-
26
- File.open("/etc/rsyslog.d/50-default.conf", 'w') { |file| file.write("*.* @@#{logstash}") }
24
+ logstash=""
25
+ if @options[:logstash] then
26
+ logstash=@options[:logstash]
27
+ else
28
+ target=@options[:target] || "logstash"
29
+ data = http_get("#{@options[:etcd]}/v2/keys/#{target}/networksettings?recursive=true")
30
+ final = eflatten( data["node"] )
31
+ logstash = "#{final["#{target}_networksettings_ipaddress"]}:514"
32
+ end
27
33
 
28
- `rsyslogd`
34
+ File.open("/etc/rsyslog.d/50-logstash.conf", 'w') { |file| file.write("*.* @@#{logstash}") }
29
35
 
30
36
  if @options[:foreground] then
31
37
  while true
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: small-ops
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.19
4
+ version: 0.0.20
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -18,7 +18,7 @@ executables:
18
18
  - etcd2env
19
19
  - etcd2conf
20
20
  - fige
21
- - rsyslogstash
21
+ - rsyslog2logstash
22
22
  extensions: []
23
23
  extra_rdoc_files: []
24
24
  files:
@@ -27,7 +27,7 @@ files:
27
27
  - bin/etcd2env
28
28
  - bin/etcd2conf
29
29
  - bin/fige
30
- - bin/rsyslogstash
30
+ - bin/rsyslog2logstash
31
31
  homepage: https://github.com/
32
32
  licenses:
33
33
  - MIT