esteem 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Readme.md +6 -1
- data/VERSION +1 -1
- data/esteem.gemspec +1 -0
- data/lib/esteem/alias.rb +56 -0
- data/lib/esteem/main.rb +14 -1
- data/lib/esteem/metadata.rb +1 -1
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 02e323e1160a84a7f4e5fd5c3d8d0a981e0f5758
|
4
|
+
data.tar.gz: 3b7eb52b2a5c3fb979f2afcb7655f0e642124b0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f79de4d37134e9ad4a96326d4bf2a7adc4e9030a049d9fd06f15b96fda93d7c659e6daaf64d7075b4fd943874458b326c42044fe0797abf102f7bd8f544a40a
|
7
|
+
data.tar.gz: 5dc836a5ae31b6f8108c67f3c19c97ea2c341bef29297710a322e963280fe43f74cb2ea56de3d7b4294e9063740c6541fa174e0786cf4f7ba8b359eb609561e1
|
data/Readme.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
data/esteem.gemspec
CHANGED
@@ -16,6 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.add_runtime_dependency 'thor', '~> 0'
|
17
17
|
s.add_runtime_dependency 'slog', '~> 1.1'
|
18
18
|
s.add_runtime_dependency 'oj', '~> 2.11'
|
19
|
+
s.add_runtime_dependency 'curb', '~> 0.8'
|
19
20
|
s.add_runtime_dependency 'rest-client', '~> 1.7'
|
20
21
|
|
21
22
|
s.files = `git ls-files`.split("\n")
|
data/lib/esteem/alias.rb
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'curb'
|
2
|
+
|
3
|
+
|
4
|
+
module Esteem
|
5
|
+
class Alias
|
6
|
+
attr_reader :success
|
7
|
+
|
8
|
+
PREFIXES = %w[
|
9
|
+
logs-atop
|
10
|
+
logs-denim logs-denim-capture
|
11
|
+
logs-rivet logs-rivet-500
|
12
|
+
logs-seam logs-seam-access logs-seam-newrelic
|
13
|
+
logs-cobalt logs-cobalt-access logs-cobalt-newrelic
|
14
|
+
logs-carder
|
15
|
+
logs-franz
|
16
|
+
logs-rollway-skinny logs-rollway-acid
|
17
|
+
logs-openstack logs-openstack-nova logs-openstack-cinder
|
18
|
+
]
|
19
|
+
|
20
|
+
|
21
|
+
def initialize month:, year:, host:
|
22
|
+
@success = false
|
23
|
+
begin
|
24
|
+
perform month, year, host
|
25
|
+
@success = true
|
26
|
+
rescue
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def perform month, year, host
|
35
|
+
(1..31).each do |day|
|
36
|
+
suffix = '%d.%02d.%02d' % [ year, month, day ]
|
37
|
+
|
38
|
+
PREFIXES.each do |logger|
|
39
|
+
|
40
|
+
Curl.post "#{host}/_aliases", {
|
41
|
+
actions: [
|
42
|
+
{
|
43
|
+
add: {
|
44
|
+
alias: "logger-#{suffix}",
|
45
|
+
index: "#{logger}-#{suffix}"
|
46
|
+
}
|
47
|
+
}
|
48
|
+
]
|
49
|
+
}
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
end
|
data/lib/esteem/main.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'thor'
|
2
2
|
require 'slog'
|
3
3
|
|
4
|
+
require_relative 'alias'
|
4
5
|
require_relative 'reindex'
|
5
6
|
require_relative 'helpers'
|
6
7
|
require_relative 'metadata'
|
@@ -30,7 +31,7 @@ module Esteem
|
|
30
31
|
|
31
32
|
|
32
33
|
desc 'reindex', 'Move data to a new index gracefully'
|
33
|
-
option :update, type: :boolean, aliases: %w[ -u ]
|
34
|
+
option :update, type: :boolean, aliases: %w[ -u ], default: false
|
34
35
|
option :frame, type: :numeric, aliases: %w[ -f ], default: 1000
|
35
36
|
option :source, type: :string, aliases: %w[ -s ], required: true
|
36
37
|
option :destination, type: :string, aliases: %w[ -d ], required: true
|
@@ -43,5 +44,17 @@ module Esteem
|
|
43
44
|
return reindex.success
|
44
45
|
end
|
45
46
|
|
47
|
+
desc 'alias', 'Add daily aliases for the given month'
|
48
|
+
option :month, type: :numeric, aliases: %w[ -m ], required: true
|
49
|
+
option :year, type: :numeric, aliases: %w[ -y ], default: Time.now.year
|
50
|
+
option :host, type: :string, aliases: %w[ -h ], default: 'http://localhost:9200'
|
51
|
+
def alias
|
52
|
+
aliasing = Alias.new \
|
53
|
+
month: options.month,
|
54
|
+
year: options.year,
|
55
|
+
host: options.host
|
56
|
+
return aliasing.success
|
57
|
+
end
|
58
|
+
|
46
59
|
end
|
47
60
|
end
|
data/lib/esteem/metadata.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: esteem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Clemmer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '2.11'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: curb
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.8'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.8'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rest-client
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,7 +81,7 @@ dependencies:
|
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '1.7'
|
69
83
|
description: Tips, tricks and scripts for managing time-based Elasticsearch indexes.
|
70
|
-
email:
|
84
|
+
email: sczizzo@gmail.com
|
71
85
|
executables:
|
72
86
|
- esteem
|
73
87
|
extensions: []
|
@@ -82,6 +96,7 @@ files:
|
|
82
96
|
- bin/esteem
|
83
97
|
- esteem.gemspec
|
84
98
|
- lib/esteem.rb
|
99
|
+
- lib/esteem/alias.rb
|
85
100
|
- lib/esteem/helpers.rb
|
86
101
|
- lib/esteem/main.rb
|
87
102
|
- lib/esteem/metadata.rb
|