semantic_logger_ecs_addon 0.1.10 → 0.1.14
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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/semantic_logger_ecs_addon/formatters/base.rb +4 -2
- data/lib/semantic_logger_ecs_addon/formatters/json.rb +4 -2
- data/lib/semantic_logger_ecs_addon/formatters/raw.rb +12 -2
- data/lib/semantic_logger_ecs_addon/identity.rb +1 -1
- data/lib/semantic_logger_ecs_addon.rb +3 -3
- data.tar.gz.sig +0 -0
- metadata +38 -24
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fab99edd113429d3c6cee4a9dbcf983943d49d0549321bb65f88200497d6c2ba
|
4
|
+
data.tar.gz: 48a33c3fcd050b88ce0057f53f7a2e7476f63eeda114ec215c59c070bdd665ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a5c0a63ededccc7dffc86b6f1ab108c96813c5ef1b9c49143b0215341b4297789d94103744bc105fcbe961e9fbc589aaf1e219aacb8700cecccafea1360fcc6
|
7
|
+
data.tar.gz: 5e6c4d3144b8f53a3acc88ef384023c4ad871fa8449aea0ee8893cfcb51796371fb42d455567e830fd37bb4da38751d0df4393142fa3ffb36bb039332d38a624
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -164,7 +164,7 @@ module SemanticLoggerEcsAddon
|
|
164
164
|
end
|
165
165
|
|
166
166
|
def format_payload
|
167
|
-
if log.payload.respond_to?(:empty?) && !log.payload.empty?
|
167
|
+
if log.payload.respond_to?(:empty?) && !log.payload.empty? && log.payload.respond_to?(:has_key?)
|
168
168
|
self.formatted_payload = Utils::Hash[**log.payload]
|
169
169
|
|
170
170
|
rack_extract
|
@@ -176,11 +176,13 @@ module SemanticLoggerEcsAddon
|
|
176
176
|
def request
|
177
177
|
hash[:"http.request.id"] = formatted_payload.dig :request, :request_id
|
178
178
|
hash[:"http.request.body.content"] = formatted_payload.dig :request, :body
|
179
|
+
hash[:"http.request.body.content"] = hash[:"http.request.body.content"].to_json if hash[:"http.request.body.content"].respond_to?(:to_json)
|
179
180
|
hash[:"http.request.method"] = formatted_payload.dig :request, :method
|
180
181
|
end
|
181
182
|
|
182
183
|
def response
|
183
184
|
hash[:"http.response.body.content"] = formatted_payload.dig :response, :body
|
185
|
+
hash[:"http.response.body.content"] = hash[:"http.response.body.content"].to_json if hash[:"http.response.body.content"].respond_to?(:to_json)
|
184
186
|
hash[:"http.response.status_code"] = formatted_payload.dig :response, :status
|
185
187
|
end
|
186
188
|
|
@@ -203,7 +205,7 @@ module SemanticLoggerEcsAddon
|
|
203
205
|
def apm_agent_present_and_running?
|
204
206
|
return false unless defined?(::ElasticAPM)
|
205
207
|
|
206
|
-
ElasticAPM.running?
|
208
|
+
::ElasticAPM.running?
|
207
209
|
end
|
208
210
|
end
|
209
211
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "
|
3
|
+
require "oj"
|
4
4
|
|
5
5
|
module SemanticLoggerEcsAddon
|
6
6
|
module Formatters
|
@@ -12,7 +12,9 @@ module SemanticLoggerEcsAddon
|
|
12
12
|
|
13
13
|
# Returns log messages in JSON format
|
14
14
|
def call log, logger
|
15
|
-
super(log, logger)
|
15
|
+
Oj.dump(super(log, logger), nilnil: true, escape_mode: :json, mode: :rails)
|
16
|
+
rescue SystemStackError => _error
|
17
|
+
Oj.dump(super(log, logger).transform_keys {|key| key.to_s }, nilnil: true, escape_mode: :json, mode: :object)
|
16
18
|
end
|
17
19
|
end
|
18
20
|
end
|
@@ -29,6 +29,8 @@ module SemanticLoggerEcsAddon
|
|
29
29
|
root = root[:"error.cause"]
|
30
30
|
end
|
31
31
|
end
|
32
|
+
rescue SystemStackError => _error
|
33
|
+
root.merge! exception_hash exception
|
32
34
|
end
|
33
35
|
|
34
36
|
def event
|
@@ -81,10 +83,18 @@ module SemanticLoggerEcsAddon
|
|
81
83
|
hash[:"user.domain"] = formatted_payload.dig :user, :type
|
82
84
|
end
|
83
85
|
|
86
|
+
def safe_jsonify hash
|
87
|
+
hash.each do |k, v|
|
88
|
+
hash[k] = v.respond_to?(:to_json) ? v.to_json : v.inspect
|
89
|
+
rescue SystemStackError => _error
|
90
|
+
hash[k] = v.inspect
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
84
94
|
def extras
|
85
|
-
return unless formatted_payload.respond_to?(:empty?) && !formatted_payload.empty?
|
95
|
+
return unless formatted_payload.respond_to?(:empty?) && !formatted_payload.empty? && formatted_payload.respond_to?(:has_key?)
|
86
96
|
|
87
|
-
hash.merge!
|
97
|
+
hash.merge!(safe_jsonify(formatted_payload.except(:request, :response, :user)))
|
88
98
|
end
|
89
99
|
|
90
100
|
# Returns log messages in Hash format
|
@@ -5,7 +5,7 @@ module SemanticLoggerEcsAddon
|
|
5
5
|
module Identity
|
6
6
|
NAME = "semantic_logger_ecs_addon"
|
7
7
|
LABEL = "Semantic Logger Ecs Addon"
|
8
|
-
VERSION = "0.1.
|
8
|
+
VERSION = "0.1.14"
|
9
9
|
VERSION_LABEL = "#{LABEL} #{VERSION}"
|
10
10
|
SUMMARY = "A semantic logger formatter that formats the logs according to Elastic Common Schema, adds APM trace data if ElasticAPM is enabled and instruments sequel logs for rails if available."
|
11
11
|
end
|
@@ -4,9 +4,9 @@ require "pathname"
|
|
4
4
|
require "zeitwerk"
|
5
5
|
|
6
6
|
loader = Zeitwerk::Loader.for_gem
|
7
|
-
loader.ignore "rails_semantic_logger"
|
8
|
-
loader.ignore "sequel"
|
9
|
-
loader.ignore "semantic_logger_ecs_addon/sequel.rb"
|
7
|
+
loader.ignore "#{__dir__}/rails_semantic_logger"
|
8
|
+
loader.ignore "#{__dir__}/sequel"
|
9
|
+
loader.ignore "#{__dir__}/semantic_logger_ecs_addon/sequel.rb"
|
10
10
|
loader.setup
|
11
11
|
|
12
12
|
# Main namespace.
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: semantic_logger_ecs_addon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sajeev Ramasamy
|
@@ -11,31 +11,45 @@ cert_chain:
|
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
13
|
MIIERDCCAqygAwIBAgIBATANBgkqhkiG9w0BAQsFADAmMSQwIgYDVQQDDBt0aG9y
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
14
|
+
aW9uMzAwNi9EQz1nbWFpbC9EQz1jb20wHhcNMjExMjI3MTM0MjUwWhcNMjIxMjI3
|
15
|
+
MTM0MjUwWjAmMSQwIgYDVQQDDBt0aG9yaW9uMzAwNi9EQz1nbWFpbC9EQz1jb20w
|
16
|
+
ggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQDeX3rgR2zbho9dxRC2QDMz
|
17
|
+
l3YDVoyyr6odDSzXge6jzbEPfV3/pWkieL7CogpK1r84SvrKMmFlslwfhSpOLxDe
|
18
|
+
Ct0/GA2IUIgB5q3iyXMU+GMGPTt6Jbe7Nih9Wak0c2qVZEkzQ91Ytz6zxQYH4GHf
|
19
|
+
pl14CZ3HZLb/pOL6YbRCj7y3ii3FBM0PpzkysGn6UkfvJPJF7RyLdUDER+tvM5D1
|
20
|
+
/1a9wiBO/UBDJ8+fHdE+zXIizP7XqIGEyiGB1cjNX0OYir9iJf7jEA0NWnJA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WiUcdHqv98HqAqyyiPuSiI46/yQgU/4D+
|
35
|
+
ApIuwzlhHr30wJqOI8K003+GUsnMkf/7aBmCfedz5dC1EF+2J2SCdg==
|
36
36
|
-----END CERTIFICATE-----
|
37
|
-
date: 2021-
|
37
|
+
date: 2021-12-27 00:00:00.000000000 Z
|
38
38
|
dependencies:
|
39
|
+
- !ruby/object:Gem::Dependency
|
40
|
+
name: oj
|
41
|
+
requirement: !ruby/object:Gem::Requirement
|
42
|
+
requirements:
|
43
|
+
- - "~>"
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '3.13'
|
46
|
+
type: :runtime
|
47
|
+
prerelease: false
|
48
|
+
version_requirements: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - "~>"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '3.13'
|
39
53
|
- !ruby/object:Gem::Dependency
|
40
54
|
name: request_store
|
41
55
|
requirement: !ruby/object:Gem::Requirement
|
@@ -126,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
140
|
- !ruby/object:Gem::Version
|
127
141
|
version: '0'
|
128
142
|
requirements: []
|
129
|
-
rubygems_version: 3.2.
|
143
|
+
rubygems_version: 3.2.32
|
130
144
|
signing_key:
|
131
145
|
specification_version: 4
|
132
146
|
summary: A semantic logger formatter that formats the logs according to Elastic Common
|
metadata.gz.sig
CHANGED
Binary file
|