manageiq-loggers 0.4.1 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +7 -4
- data/.rubocop.yml +3 -2
- data/.rubocop_cc.yml +3 -3
- data/.travis.yml +0 -1
- data/CHANGELOG.md +34 -1
- data/README.md +1 -1
- data/lib/manageiq/loggers/base.rb +1 -1
- data/lib/manageiq/loggers/cloud_watch.rb +1 -2
- data/lib/manageiq/loggers/container.rb +15 -8
- data/lib/manageiq/loggers/journald.rb +8 -6
- data/lib/manageiq/loggers/version.rb +1 -1
- data/manageiq-loggers.gemspec +3 -2
- metadata +28 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46aa465df04eec849cc5a424cb86b25e856d08d53a8946de00eeed6c6b0bfb84
|
4
|
+
data.tar.gz: de25e24d88f68587f5da9bd4826072ea9d81fbd46f4ba094c0d1ad75ed3c26eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0152260cca77e6953667c9e57e918404824f91cfb95fa5ec7570ac3cd891f889d3f47865bcb3440681b83dbf80e5392fb46cc96d9db7e761093693bfc59c72ee
|
7
|
+
data.tar.gz: 2d5e985ac09b88eefc58becebf83e8d9805422e79e7eaa575a9a6c8dbb59564e053f8f2b2f7f55690ae6ac29d5b47fccfd78c1ec7b08f127500cd62cbc3a748b
|
data/.codeclimate.yml
CHANGED
@@ -1,11 +1,14 @@
|
|
1
|
-
---
|
2
1
|
version: '2'
|
3
2
|
prepare:
|
4
3
|
fetch:
|
5
|
-
- url: https://raw.githubusercontent.com/ManageIQ/
|
4
|
+
- url: https://raw.githubusercontent.com/ManageIQ/manageiq-style/master/.rubocop_base.yml
|
6
5
|
path: ".rubocop_base.yml"
|
7
|
-
- url: https://raw.githubusercontent.com/ManageIQ/
|
6
|
+
- url: https://raw.githubusercontent.com/ManageIQ/manageiq-style/master/.rubocop_cc_base.yml
|
8
7
|
path: ".rubocop_cc_base.yml"
|
8
|
+
- url: https://raw.githubusercontent.com/ManageIQ/manageiq-style/master/styles/base.yml
|
9
|
+
path: styles/base.yml
|
10
|
+
- url: https://raw.githubusercontent.com/ManageIQ/manageiq-style/master/styles/cc_base.yml
|
11
|
+
path: styles/cc_base.yml
|
9
12
|
checks:
|
10
13
|
argument-count:
|
11
14
|
enabled: false
|
@@ -28,4 +31,4 @@ plugins:
|
|
28
31
|
rubocop:
|
29
32
|
enabled: true
|
30
33
|
config: ".rubocop_cc.yml"
|
31
|
-
channel:
|
34
|
+
channel: rubocop-0-82
|
data/.rubocop.yml
CHANGED
data/.rubocop_cc.yml
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
inherit_from:
|
2
|
-
- .rubocop_base.yml
|
3
|
-
- .rubocop_cc_base.yml
|
4
|
-
- .rubocop_local.yml
|
2
|
+
- ".rubocop_base.yml"
|
3
|
+
- ".rubocop_cc_base.yml"
|
4
|
+
- ".rubocop_local.yml"
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,35 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
7
|
|
8
|
+
## [0.7.0] - 2021-09-21
|
9
|
+
### Changed
|
10
|
+
- Truncate log lines to 8Kb [(#32)](https://github.com/ManageIQ/manageiq-loggers/pull/32)
|
11
|
+
- Honor container log level [(#35)](https://github.com/ManageIQ/manageiq-loggers/pull/35)
|
12
|
+
- Use progname rather than syslog_identifier for journald logs [(#36)](https://github.com/ManageIQ/manageiq-loggers/pull/36)
|
13
|
+
|
14
|
+
### Fixed
|
15
|
+
- Handle Unicode characters in binary messages. [(#34)](https://github.com/ManageIQ/manageiq-loggers/pull/34)
|
16
|
+
|
17
|
+
## [0.6.0] - 2020-12-09
|
18
|
+
### Changed
|
19
|
+
- Update rake dependency to address CVE-2020-8130 [(#19)](https://github.com/ManageIQ/manageiq-loggers/pull/19)
|
20
|
+
|
21
|
+
### Fixed
|
22
|
+
- Fix escaping of < and > in Container logger [(#29)](https://github.com/ManageIQ/manageiq-loggers/pull/29)
|
23
|
+
- Fix ActiveSupport::Deprecation call [(#29)](https://github.com/ManageIQ/manageiq-loggers/pull/29)
|
24
|
+
- Fix the handling of journald code_file/code_line [(#21)](https://github.com/ManageIQ/manageiq-loggers/pull/21) [(#22)](https://github.com/ManageIQ/manageiq-loggers/pull/22)
|
25
|
+
|
26
|
+
### Added
|
27
|
+
- Add code_func to the journald logger [(#23)](https://github.com/ManageIQ/manageiq-loggers/pull/23)
|
28
|
+
|
29
|
+
## [0.5.0] - 2020-03-18
|
30
|
+
### Changed
|
31
|
+
- Deprecate Thread.current[:current_request]&.request_id in favor of Thread.current[:request_id] [(#17)](https://github.com/ManageIQ/manageiq-loggers/pull/17)
|
32
|
+
|
33
|
+
## [0.4.2] - 2020-01-14
|
34
|
+
### Fixed
|
35
|
+
- Revert "Change CloudWatch log_group to be the namespace if it exists" [(#16)](https://github.com/ManageIQ/manageiq-loggers/pull/16)
|
36
|
+
|
8
37
|
## [0.4.1] - 2020-01-06
|
9
38
|
### Fixed
|
10
39
|
- Change CloudWatch logger log_group and log_stream values for easier debugging and unique identifiers [(#15)](https://github.com/ManageIQ/manageiq-loggers/pull/15)
|
@@ -29,7 +58,11 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
29
58
|
|
30
59
|
## [0.1.0] - 2019-01-08
|
31
60
|
|
32
|
-
[Unreleased]: https://github.com/ManageIQ/manageiq-loggers/compare/v0.
|
61
|
+
[Unreleased]: https://github.com/ManageIQ/manageiq-loggers/compare/v0.7.0...master
|
62
|
+
[0.7.0]: https://github.com/ManageIQ/manageiq-loggers/compare/v0.6.0...v0.7.0
|
63
|
+
[0.6.0]: https://github.com/ManageIQ/manageiq-loggers/compare/v0.5.0...v0.6.0
|
64
|
+
[0.5.0]: https://github.com/ManageIQ/manageiq-loggers/compare/v0.4.2...v0.5.0
|
65
|
+
[0.4.2]: https://github.com/ManageIQ/manageiq-loggers/compare/v0.4.1...v0.4.2
|
33
66
|
[0.4.1]: https://github.com/ManageIQ/manageiq-loggers/compare/v0.4.0...v0.4.1
|
34
67
|
[0.4.0]: https://github.com/ManageIQ/manageiq-loggers/compare/v0.3.0...v0.4.0
|
35
68
|
[0.3.0]: https://github.com/ManageIQ/manageiq-loggers/compare/v0.2.0...v0.3.0
|
data/README.md
CHANGED
@@ -39,7 +39,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
39
39
|
|
40
40
|
## Contributing
|
41
41
|
|
42
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
42
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/ManageIQ/manageiq-loggers.
|
43
43
|
|
44
44
|
## License
|
45
45
|
|
@@ -9,8 +9,7 @@ module ManageIQ
|
|
9
9
|
def self.new(*args)
|
10
10
|
access_key_id = ENV["CW_AWS_ACCESS_KEY_ID"].presence
|
11
11
|
secret_access_key = ENV["CW_AWS_SECRET_ACCESS_KEY"].presence
|
12
|
-
|
13
|
-
log_group_name = namespace || ENV["CLOUD_WATCH_LOG_GROUP"].presence
|
12
|
+
log_group_name = ENV["CLOUD_WATCH_LOG_GROUP"].presence
|
14
13
|
log_stream_name = ENV["HOSTNAME"].presence
|
15
14
|
|
16
15
|
container_logger = ManageIQ::Loggers::Container.new
|
@@ -5,12 +5,8 @@ module ManageIQ
|
|
5
5
|
logdev.sync = true # Don't buffer container log output
|
6
6
|
|
7
7
|
super
|
8
|
-
self.level = DEBUG
|
9
|
-
self.formatter = Formatter.new
|
10
|
-
end
|
11
8
|
|
12
|
-
|
13
|
-
super(DEBUG) # We want everything written to the ContainerLogger written to STDOUT
|
9
|
+
self.formatter = Formatter.new
|
14
10
|
end
|
15
11
|
|
16
12
|
def filename
|
@@ -36,7 +32,7 @@ module ManageIQ
|
|
36
32
|
def call(severity, time, progname, msg)
|
37
33
|
# From https://github.com/ViaQ/elasticsearch-templates/releases -> Downloads -> *.asciidoc
|
38
34
|
# NOTE: These values are in a specific order for easier human readbility via STDOUT
|
39
|
-
{
|
35
|
+
payload = {
|
40
36
|
:@timestamp => format_datetime(time),
|
41
37
|
:hostname => hostname,
|
42
38
|
:pid => $PROCESS_ID,
|
@@ -46,7 +42,13 @@ module ManageIQ
|
|
46
42
|
:message => prefix_task_id(msg2str(msg)),
|
47
43
|
:request_id => request_id
|
48
44
|
# :tags => "tags string",
|
49
|
-
}.compact
|
45
|
+
}.compact
|
46
|
+
JSON.generate(payload) << "\n"
|
47
|
+
rescue Encoding::UndefinedConversionError
|
48
|
+
raise unless msg.encoding == Encoding::ASCII_8BIT
|
49
|
+
|
50
|
+
msg.force_encoding("UTF-8")
|
51
|
+
retry
|
50
52
|
end
|
51
53
|
|
52
54
|
private
|
@@ -64,7 +66,12 @@ module ManageIQ
|
|
64
66
|
end
|
65
67
|
|
66
68
|
def request_id
|
67
|
-
Thread.current[:current_request]&.request_id
|
69
|
+
Thread.current[:request_id] || Thread.current[:current_request]&.request_id.tap do |request_id|
|
70
|
+
if request_id
|
71
|
+
require "active_support/deprecation"
|
72
|
+
ActiveSupport::Deprecation.warn("Usage of `Thread.current[:current_request]&.request_id` will be deprecated in version 0.5.0. Please switch to `Thread.current[:request_id]` to log request_id automatically.")
|
73
|
+
end
|
74
|
+
end
|
68
75
|
end
|
69
76
|
end
|
70
77
|
end
|
@@ -1,8 +1,10 @@
|
|
1
1
|
module ManageIQ
|
2
2
|
module Loggers
|
3
3
|
class Journald < Base
|
4
|
-
|
5
|
-
|
4
|
+
require "active_support/core_ext/module/aliasing"
|
5
|
+
|
6
|
+
# Alias syslog_identifier for backwards compatibility
|
7
|
+
alias_attribute :syslog_identifier, :progname
|
6
8
|
|
7
9
|
# Create and return a new ManageIQ::Loggers::Journald instance. The
|
8
10
|
# arguments to the initializer can be ignored unless you're multicasting.
|
@@ -15,7 +17,6 @@ module ManageIQ
|
|
15
17
|
super(logdev, *args)
|
16
18
|
@formatter = Formatter.new
|
17
19
|
@progname ||= 'manageiq'
|
18
|
-
@syslog_identifier ||= @progname
|
19
20
|
end
|
20
21
|
|
21
22
|
# Comply with the VMDB::Logger interface. For a filename we simply use
|
@@ -44,14 +45,15 @@ module ManageIQ
|
|
44
45
|
end
|
45
46
|
|
46
47
|
message = formatter.call(format_severity(severity), progname, message)
|
47
|
-
caller_object = caller_locations.
|
48
|
+
caller_object = caller_locations(3, 1).first
|
48
49
|
|
49
50
|
Systemd::Journal.message(
|
50
51
|
:message => message,
|
51
52
|
:priority => log_level_map[severity],
|
52
|
-
:syslog_identifier =>
|
53
|
+
:syslog_identifier => progname,
|
53
54
|
:code_line => caller_object.lineno,
|
54
|
-
:code_file => caller_object.absolute_path
|
55
|
+
:code_file => caller_object.absolute_path,
|
56
|
+
:code_func => caller_object.label
|
55
57
|
)
|
56
58
|
end
|
57
59
|
|
data/manageiq-loggers.gemspec
CHANGED
@@ -23,11 +23,12 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.require_paths = ["lib"]
|
24
24
|
|
25
25
|
spec.add_runtime_dependency "activesupport", ">= 5.0"
|
26
|
-
spec.add_runtime_dependency "manageiq-password", "
|
26
|
+
spec.add_runtime_dependency "manageiq-password", "< 2"
|
27
27
|
|
28
28
|
spec.add_development_dependency "bundler"
|
29
29
|
spec.add_development_dependency "cloudwatchlogger"
|
30
|
-
spec.add_development_dependency "
|
30
|
+
spec.add_development_dependency "manageiq-style"
|
31
|
+
spec.add_development_dependency "rake", ">= 12.3.3"
|
31
32
|
spec.add_development_dependency "rspec", "~> 3.0"
|
32
33
|
spec.add_development_dependency "simplecov"
|
33
34
|
spec.add_development_dependency "systemd-journal" if RbConfig::CONFIG['host_os'] =~ /linux/i
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: manageiq-loggers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ManageIQ Authors
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: manageiq-password
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "<"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '2'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "<"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,49 +67,49 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: manageiq-style
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: rake
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 12.3.3
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: 12.3.3
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: rspec
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - "
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
103
|
+
version: '3.0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - "
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
110
|
+
version: '3.0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
112
|
+
name: simplecov
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - ">="
|
@@ -122,8 +122,8 @@ dependencies:
|
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
-
description:
|
126
|
-
email:
|
125
|
+
description:
|
126
|
+
email:
|
127
127
|
executables: []
|
128
128
|
extensions: []
|
129
129
|
extra_rdoc_files: []
|
@@ -154,7 +154,7 @@ homepage: https://github.com/ManageIQ/manageiq-loggers
|
|
154
154
|
licenses:
|
155
155
|
- Apache-2.0
|
156
156
|
metadata: {}
|
157
|
-
post_install_message:
|
157
|
+
post_install_message:
|
158
158
|
rdoc_options: []
|
159
159
|
require_paths:
|
160
160
|
- lib
|
@@ -169,8 +169,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
169
169
|
- !ruby/object:Gem::Version
|
170
170
|
version: '0'
|
171
171
|
requirements: []
|
172
|
-
rubygems_version: 3.
|
173
|
-
signing_key:
|
172
|
+
rubygems_version: 3.1.4
|
173
|
+
signing_key:
|
174
174
|
specification_version: 4
|
175
175
|
summary: Loggers for ManageIQ projects
|
176
176
|
test_files: []
|