10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/command_tower/logging/projection.rb', line 10
def call(event)
payload = symbolize(event.payload)
projected = { event: event.name }
copy_if_present(projected, payload, :subject)
copy_if_present(projected, payload, :execution_uuid)
copy_if_present(projected, payload, :correlation_id)
copy_if_present(projected, payload, :outcome)
copy_if_present(projected, payload, :duration_ms)
copy_if_present(projected, payload, :user_id)
copy_if_present(projected, payload, :error_class)
copy_if_present(projected, payload, :error_codes)
copy_if_present(projected, payload, :causation_id)
copy_if_present(projected, payload, :originating_administrator_id)
request_id = payload[:request_id]
if !request_id.nil? && request_id != payload[:correlation_id]
projected[:request_id] = request_id
end
source = payload[:source]
projected[:source] = source if !source.nil? && source.to_s != "http"
effective = payload[:effective_user_id]
projected[:effective_user_id] = effective if !effective.nil? && effective != payload[:user_id]
projected[:impersonation_active] = true if payload[:impersonation_active] == true
payload.each do |key, value|
next if DROP.include?(key)
next if projected.key?(key)
next if value.nil?
next if key == :impersonation_active
next if key == :source
next if key == :request_id
next if key == :effective_user_id
projected[key] = value
end
projected
end
|