ufo 4.6.0 → 4.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/docs/_reference/ufo-logs.md +10 -9
- data/lib/ufo/cli.rb +1 -0
- data/lib/ufo/dsl/helper.rb +13 -1
- data/lib/ufo/logs.rb +5 -4
- data/lib/ufo/tasks/register.rb +11 -8
- data/lib/ufo/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed46bcbd9a6677e6a6d8ac6ec6bec143398fe5662aef5833d949c75d604d55c8
|
4
|
+
data.tar.gz: 631c1980a669e8fdebb44446246d22683ec0848d0a141f76ca8c1d538acb9710
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1e43ccef253916b2ba63e5202e37297d68d6021cf16c64c679ad7dceee98409c25d8fc2afa80fa115435871ebc36a91d8cf89e9faad7c9a091ca1f9064927ff
|
7
|
+
data.tar.gz: e8b6be518ea85b407cb73fba4d1240d38f646ae3c330e4cf6d948d3a496b4e0e98b5aca1112dc3043beb92cb356cf835cc58207fee2753e50bc6a89f685eff6b
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,11 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
|
5
5
|
|
6
|
+
## [4.6.1]
|
7
|
+
- #93 Fix firelens functionality
|
8
|
+
- #97 ufo logs --filter-pattern option
|
9
|
+
- #98 fix env vars helper to allow surrounding quotes
|
10
|
+
|
6
11
|
## [4.6.0]
|
7
12
|
- #95 Introduce: ufo logs command. Tail logs.
|
8
13
|
- #96 docs and options
|
data/docs/_reference/ufo-logs.md
CHANGED
@@ -26,14 +26,15 @@ If you have a current service name set.
|
|
26
26
|
## Options
|
27
27
|
|
28
28
|
```
|
29
|
-
[--follow], [--no-follow]
|
30
|
-
|
31
|
-
[--since=SINCE]
|
32
|
-
[--format=FORMAT]
|
33
|
-
|
34
|
-
[--
|
35
|
-
[--
|
36
|
-
[--
|
37
|
-
[--
|
29
|
+
[--follow], [--no-follow] # Whether to continuously poll for new logs. To exit from this mode, use Control-C.
|
30
|
+
# Default: true
|
31
|
+
[--since=SINCE] # From what time to begin displaying logs. By default, logs will be displayed starting from 1 minutes in the past. The value provided can be an ISO 8601 timestamp or a relative time.
|
32
|
+
[--format=FORMAT] # The format to display the logs. IE: detailed or short. With detailed, the log stream name is also shown.
|
33
|
+
# Default: simple
|
34
|
+
[--filter-pattern=FILTER_PATTERN] # The filter pattern to use. If not provided, all the events are matched
|
35
|
+
[--verbose], [--no-verbose]
|
36
|
+
[--mute], [--no-mute]
|
37
|
+
[--noop], [--no-noop]
|
38
|
+
[--cluster=CLUSTER] # Cluster. Overrides .ufo/settings.yml.
|
38
39
|
```
|
39
40
|
|
data/lib/ufo/cli.rb
CHANGED
@@ -192,6 +192,7 @@ module Ufo
|
|
192
192
|
option :follow, default: true, type: :boolean, desc: " Whether to continuously poll for new logs. To exit from this mode, use Control-C."
|
193
193
|
option :since, desc: "From what time to begin displaying logs. By default, logs will be displayed starting from 1 minutes in the past. The value provided can be an ISO 8601 timestamp or a relative time."
|
194
194
|
option :format, default: "simple", desc: "The format to display the logs. IE: detailed or short. With detailed, the log stream name is also shown."
|
195
|
+
option :filter_pattern, desc: "The filter pattern to use. If not provided, all the events are matched"
|
195
196
|
def logs(service=:current)
|
196
197
|
Logs.new(service, options).run
|
197
198
|
end
|
data/lib/ufo/dsl/helper.rb
CHANGED
@@ -30,7 +30,9 @@ module Ufo
|
|
30
30
|
def env_vars(text)
|
31
31
|
lines = filtered_lines(text)
|
32
32
|
lines.map do |line|
|
33
|
-
key,*value = line.strip.split("=").map
|
33
|
+
key,*value = line.strip.split("=").map do |x|
|
34
|
+
remove_surrounding_quotes(x.strip)
|
35
|
+
end
|
34
36
|
value = value.join('=')
|
35
37
|
{
|
36
38
|
name: key,
|
@@ -39,6 +41,16 @@ module Ufo
|
|
39
41
|
end
|
40
42
|
end
|
41
43
|
|
44
|
+
def remove_surrounding_quotes(s)
|
45
|
+
if s =~ /^"/ && s =~ /"$/
|
46
|
+
s.sub(/^["]/, '').gsub(/["]$/,'') # remove surrounding double quotes
|
47
|
+
elsif s =~ /^'/ && s =~ /'$/
|
48
|
+
s.sub(/^[']/, '').gsub(/[']$/,'') # remove surrounding single quotes
|
49
|
+
else
|
50
|
+
s
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
42
54
|
def filtered_lines(text)
|
43
55
|
lines = text.split("\n")
|
44
56
|
# remove comment at the end of the line
|
data/lib/ufo/logs.rb
CHANGED
@@ -41,14 +41,15 @@ module Ufo
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def cloudwatch_tail(log={})
|
44
|
-
|
45
|
-
cw_tail = AwsLogs::Tail.new(
|
44
|
+
o = {
|
46
45
|
log_group_name: log["awslogs-group"],
|
47
46
|
log_stream_name_prefix: log["awslogs-stream-prefix"],
|
48
|
-
since: since,
|
47
|
+
since: @options[:since] || "10m", # by default, search only 10 mins in the past
|
49
48
|
follow: @options[:follow],
|
50
49
|
format: @options[:format],
|
51
|
-
|
50
|
+
}
|
51
|
+
o[:filter_pattern] = @options[:filter_pattern] if @options[:filter_pattern]
|
52
|
+
cw_tail = AwsLogs::Tail.new(o)
|
52
53
|
cw_tail.run
|
53
54
|
end
|
54
55
|
end
|
data/lib/ufo/tasks/register.rb
CHANGED
@@ -70,15 +70,18 @@ module Ufo
|
|
70
70
|
|
71
71
|
definitions = data[:container_definitions]
|
72
72
|
definitions.each_with_index do |definition, i|
|
73
|
-
next unless definition[:log_configuration]
|
74
|
-
|
75
|
-
|
73
|
+
next unless definition[:log_configuration] || definition[:firelens_configuration]
|
74
|
+
{ log_configuration: 'logConfiguration',
|
75
|
+
firelens_configuration: 'firelensConfiguration' }.each_pair do |key, value|
|
76
76
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
77
|
+
next unless definition.dig(key, :options)
|
78
|
+
|
79
|
+
# LogConfiguration and firelensConfiguration options do not get transformed and
|
80
|
+
# keep their original structure:
|
81
|
+
# https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/ECS/Types/ContainerDefinition.html
|
82
|
+
original_definition = original_data["containerDefinitions"][i]
|
83
|
+
definition[key][:options] = original_definition[value]["options"]
|
84
|
+
end
|
82
85
|
end
|
83
86
|
|
84
87
|
data
|
data/lib/ufo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ufo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.6.
|
4
|
+
version: 4.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-01-
|
11
|
+
date: 2020-01-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-logs
|