manageiq-loggers 0.4.2 → 0.8.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 +6 -3
- data/CHANGELOG.md +36 -1
- data/README.md +1 -1
- data/lib/manageiq/loggers/base.rb +23 -3
- 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: 4fde8d7f48465068c802390222f9f37f00b644b8932637ec6818c0ecec91acbe
|
4
|
+
data.tar.gz: 6ad670852b8d6ce6e0803076ce730a288a0c5fd96f1c49c412b8f4dc1c075736
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa8bf70516aa9db5bc934289dc0512e7aa19203cf9794e7692f5c749e33fd3c2b974c9919f89c318cbb931cb1fd4c37639c19d1df7e119473e2227acf513dc4e
|
7
|
+
data.tar.gz: 03bd1d9088c70a6344f5803abef6f262994518c9d9c3bfaa8e91e87a66f9fc4828b2d9dc925b0c067e7d1462a0e36b7648edec84fd7d0858bdbefda40835dda7
|
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
@@ -1,10 +1,13 @@
|
|
1
1
|
---
|
2
2
|
language: ruby
|
3
|
-
|
3
|
+
dist: bionic
|
4
4
|
cache: bundler
|
5
5
|
rvm:
|
6
|
-
- 2.4.
|
7
|
-
- 2.5.
|
6
|
+
- 2.4.10
|
7
|
+
- 2.5.9
|
8
|
+
- 2.6.8
|
9
|
+
- 2.7.4
|
10
|
+
- 3.0.2
|
8
11
|
before_script:
|
9
12
|
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
10
13
|
- chmod +x ./cc-test-reporter
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,37 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
7
|
|
8
|
+
## [0.8.0] - 2021-11-15
|
9
|
+
|
10
|
+
### Changed
|
11
|
+
- Add Ruby 2.6, 2.7, and 3.0 to the test matrix
|
12
|
+
- Add ability to set class-level and instance-level filters for log_hashes
|
13
|
+
|
14
|
+
## [0.7.0] - 2021-09-21
|
15
|
+
### Changed
|
16
|
+
- Truncate log lines to 8Kb [(#32)](https://github.com/ManageIQ/manageiq-loggers/pull/32)
|
17
|
+
- Honor container log level [(#35)](https://github.com/ManageIQ/manageiq-loggers/pull/35)
|
18
|
+
- Use progname rather than syslog_identifier for journald logs [(#36)](https://github.com/ManageIQ/manageiq-loggers/pull/36)
|
19
|
+
|
20
|
+
### Fixed
|
21
|
+
- Handle Unicode characters in binary messages. [(#34)](https://github.com/ManageIQ/manageiq-loggers/pull/34)
|
22
|
+
|
23
|
+
## [0.6.0] - 2020-12-09
|
24
|
+
### Changed
|
25
|
+
- Update rake dependency to address CVE-2020-8130 [(#19)](https://github.com/ManageIQ/manageiq-loggers/pull/19)
|
26
|
+
|
27
|
+
### Fixed
|
28
|
+
- Fix escaping of < and > in Container logger [(#29)](https://github.com/ManageIQ/manageiq-loggers/pull/29)
|
29
|
+
- Fix ActiveSupport::Deprecation call [(#29)](https://github.com/ManageIQ/manageiq-loggers/pull/29)
|
30
|
+
- 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)
|
31
|
+
|
32
|
+
### Added
|
33
|
+
- Add code_func to the journald logger [(#23)](https://github.com/ManageIQ/manageiq-loggers/pull/23)
|
34
|
+
|
35
|
+
## [0.5.0] - 2020-03-18
|
36
|
+
### Changed
|
37
|
+
- Deprecate Thread.current[:current_request]&.request_id in favor of Thread.current[:request_id] [(#17)](https://github.com/ManageIQ/manageiq-loggers/pull/17)
|
38
|
+
|
8
39
|
## [0.4.2] - 2020-01-14
|
9
40
|
### Fixed
|
10
41
|
- Revert "Change CloudWatch log_group to be the namespace if it exists" [(#16)](https://github.com/ManageIQ/manageiq-loggers/pull/16)
|
@@ -33,7 +64,11 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
33
64
|
|
34
65
|
## [0.1.0] - 2019-01-08
|
35
66
|
|
36
|
-
[Unreleased]: https://github.com/ManageIQ/manageiq-loggers/compare/v0.
|
67
|
+
[Unreleased]: https://github.com/ManageIQ/manageiq-loggers/compare/v0.8.0...master
|
68
|
+
[0.8.0]: https://github.com/ManageIQ/manageiq-loggers/compare/v0.7.0...v0.8.0
|
69
|
+
[0.7.0]: https://github.com/ManageIQ/manageiq-loggers/compare/v0.6.0...v0.7.0
|
70
|
+
[0.6.0]: https://github.com/ManageIQ/manageiq-loggers/compare/v0.5.0...v0.6.0
|
71
|
+
[0.5.0]: https://github.com/ManageIQ/manageiq-loggers/compare/v0.4.2...v0.5.0
|
37
72
|
[0.4.2]: https://github.com/ManageIQ/manageiq-loggers/compare/v0.4.1...v0.4.2
|
38
73
|
[0.4.1]: https://github.com/ManageIQ/manageiq-loggers/compare/v0.4.0...v0.4.1
|
39
74
|
[0.4.0]: https://github.com/ManageIQ/manageiq-loggers/compare/v0.3.0...v0.4.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
|
|
@@ -7,7 +7,7 @@ require 'English'
|
|
7
7
|
module ManageIQ
|
8
8
|
module Loggers
|
9
9
|
class Base < Logger
|
10
|
-
MAX_LOG_LINE_LENGTH =
|
10
|
+
MAX_LOG_LINE_LENGTH = 8.kilobytes
|
11
11
|
|
12
12
|
def initialize(*args)
|
13
13
|
super
|
@@ -72,13 +72,24 @@ module ManageIQ
|
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
|
+
private_class_method def self.clean_log_hashes_filter(filters)
|
76
|
+
(Array(filters).compact.map(&:to_s) << "password").uniq
|
77
|
+
end
|
78
|
+
|
79
|
+
def self.log_hashes_filter
|
80
|
+
@log_hashes_filter ||= ["password"]
|
81
|
+
end
|
82
|
+
|
83
|
+
def self.log_hashes_filter=(filters)
|
84
|
+
@log_hashes_filter = clean_log_hashes_filter(filters)
|
85
|
+
end
|
86
|
+
|
75
87
|
def self.log_hashes(logger, h, options = {})
|
76
88
|
require 'yaml'
|
77
89
|
require 'manageiq/password'
|
78
90
|
|
79
91
|
level = options[:log_level] || :info
|
80
|
-
filter =
|
81
|
-
filter.uniq!
|
92
|
+
filter = options[:filter] ? clean_log_hashes_filter(options[:filter]) : log_hashes_filter
|
82
93
|
|
83
94
|
values = YAML.dump(h.to_hash).gsub(ManageIQ::Password::REGEXP, "[FILTERED]")
|
84
95
|
values = values.split("\n").map do |l|
|
@@ -91,7 +102,16 @@ module ManageIQ
|
|
91
102
|
logger.send(level, "\n#{values}")
|
92
103
|
end
|
93
104
|
|
105
|
+
def log_hashes_filter
|
106
|
+
@log_hashes_filter || self.class.log_hashes_filter
|
107
|
+
end
|
108
|
+
|
109
|
+
def log_hashes_filter=(filters)
|
110
|
+
@log_hashes_filter = self.class.send(:clean_log_hashes_filter, filters)
|
111
|
+
end
|
112
|
+
|
94
113
|
def log_hashes(h, options = {})
|
114
|
+
options[:filter] ||= log_hashes_filter
|
95
115
|
self.class.log_hashes(self, h, options)
|
96
116
|
end
|
97
117
|
|
@@ -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.8.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-11-16 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.6
|
173
|
+
signing_key:
|
174
174
|
specification_version: 4
|
175
175
|
summary: Loggers for ManageIQ projects
|
176
176
|
test_files: []
|