small-ops 0.0.18 → 0.0.19

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.
Files changed (2) hide show
  1. data/bin/rsyslogstash +35 -0
  2. metadata +3 -1
data/bin/rsyslogstash ADDED
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'small-setup'
4
+
5
+ OptionParser.new do |opts|
6
+ opts.banner = "Usage: command [options]"
7
+ opts.on("-h", "--host host", "Set host IP/domain") do |h|
8
+ @options[:host] = h
9
+ end
10
+ opts.on("-e", "--etcd host:port", "Set etcd host and port") do |e|
11
+ @options[:etcd] = e
12
+ end
13
+ opts.on("-t", "--target container", "Set container to use with logstash") do |t|
14
+ @options[:target] = t
15
+ end
16
+ opts.on("-f","--foreground","Keep running on foregroud. Default is run once and exit.") do |f|
17
+ @options[:foreground]=f
18
+ end
19
+ end.parse!
20
+
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}") }
27
+
28
+ `rsyslogd`
29
+
30
+ if @options[:foreground] then
31
+ while true
32
+ sleep 100
33
+ end
34
+ end
35
+
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.18
4
+ version: 0.0.19
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -18,6 +18,7 @@ executables:
18
18
  - etcd2env
19
19
  - etcd2conf
20
20
  - fige
21
+ - rsyslogstash
21
22
  extensions: []
22
23
  extra_rdoc_files: []
23
24
  files:
@@ -26,6 +27,7 @@ files:
26
27
  - bin/etcd2env
27
28
  - bin/etcd2conf
28
29
  - bin/fige
30
+ - bin/rsyslogstash
29
31
  homepage: https://github.com/
30
32
  licenses:
31
33
  - MIT