Class: ZuoraObservability::Logging::Formatter
- Inherits:
-
Ougai::Formatters::Bunyan
- Object
- Ougai::Formatters::Bunyan
- ZuoraObservability::Logging::Formatter
- Defined in:
- lib/zuora_observability/logging/formatter.rb
Overview
Formats data into ZECS Logging Standard and dumps as JSON tag.pages.gitlab.zeta.tools/standards/logging
Constant Summary collapse
- ECS_VERSION =
'1.5.0'
- ZECS_TOP_LEVEL_FIELDS =
%i[ error event http organization process url user ].freeze
- ECS_HTTP_FIELDS =
%i[request response].freeze
Instance Method Summary collapse
- #_call(severity, time, progname, data) ⇒ Object
-
#convert_time(data) ⇒ Object
Note(hartley): Ougai::Formatters::ForJson requires this be present.
Instance Method Details
#_call(severity, time, progname, data) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/zuora_observability/logging/formatter.rb', line 15 def _call(severity, time, progname, data) output = base_fields(severity, time, progname, data) other_fields = get_fields_for(ZECS_TOP_LEVEL_FIELDS, data) output.merge!(other_fields) zuora_fields = ZuoraFields.call(data) output[:zuora] = zuora_fields unless zuora_fields.empty? dump(output) end |
#convert_time(data) ⇒ Object
Note(hartley): Ougai::Formatters::ForJson requires this be present
28 29 30 |
# File 'lib/zuora_observability/logging/formatter.rb', line 28 def convert_time(data) data[:@timestamp] = data[:@timestamp].utc.iso8601(3) end |