heavylog 0.0.21 → 0.0.22

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1e5698a7bfa3d9476d9b35f0a0da99a7faeeb230df8889599cf343b017745488
4
- data.tar.gz: 74d24b9be2f75463929bc5de1cb076fca87cb7b707a7123474a95682b3899e4a
3
+ metadata.gz: 97686d14f27208a6334ce6c76a20d11562fdbe2affdb5d3794b7baae2620c6c6
4
+ data.tar.gz: fee3b90c91fe906b10bcb7b4b109d90b328a166925b9fe4d82e7459089e6e593
5
5
  SHA512:
6
- metadata.gz: 1dde2fc6a5912a2345729bd7150d1a6c39b55ab4f90800ee2cbe61acb3f351c978ecadea820981ba1cc94180140d8ddbab0f0f6890901c6251a906b2be9343a7
7
- data.tar.gz: b7a5930b2cba4fa6501798ac200978a5c172cda4af2b0d1dd55dc23bf0373edde9c722b1b3cbf658f68163d03adee190814f3d342bf621bf5d11c7eeab03dbaa
6
+ metadata.gz: 4b2949b2eb311aed8c768b8d4f1cf259c843d5efe2a200dfce835da0e87752f736a3a26e2cdb5853a7428178ba524e9af22260b9459de97ba09de95e5e4d0d0e
7
+ data.tar.gz: 8a492bc19d4b02ca5d3fb0ea9fff617cd556eb5a328f6e6cd8f8a573f12630463cb9a66e6c5570d7bf7b2aa3adc91ece833094a777434bea4205d9cbc389dd40
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- heavylog (0.0.21)
4
+ heavylog (0.0.22)
5
5
  actionpack (>= 5)
6
6
  activesupport (>= 5)
7
7
  railties (>= 5)
@@ -16,7 +16,9 @@ module Heavylog
16
16
  "status" => "http.response.status_code",
17
17
  "location" => "http.response.location",
18
18
  "ip" => "source.address",
19
+ "host" => "url.domain",
19
20
  "path" => "url.original",
21
+ "user_agent" => "user_agent.original",
20
22
  "controller" => "heavylog.controller",
21
23
  "action" => "heavylog.action",
22
24
  "unpermitted_params" => "heavylog.unpermitted_params",
@@ -28,7 +30,7 @@ module Heavylog
28
30
 
29
31
  def call(data)
30
32
  ECS_MAP.each do |original, correct|
31
- dig_set(data, correct.split("."), data.delete(original)) if data[original]
33
+ dig_set(data, correct.split("."), data.delete(original)) if data.key?(original)
32
34
  end
33
35
 
34
36
  dig_set(data, %w[event module], "heavylog")
@@ -31,7 +31,7 @@ module Heavylog
31
31
  data.merge!(extract_runtimes(event, payload))
32
32
  data.merge!(extract_location)
33
33
  data.merge!(extract_unpermitted_params)
34
- data.merge!(extract_referrer(payload))
34
+ data.merge!(extract_request_data(payload))
35
35
  data.merge!(custom_options(event))
36
36
  end
37
37
 
@@ -103,9 +103,15 @@ module Heavylog
103
103
  { unpermitted_params: unpermitted_params }
104
104
  end
105
105
 
106
- def extract_referrer(payload)
107
- if payload[:request].is_a?(ActionDispatch::Request) && payload[:request].referrer
108
- return { referrer: payload[:request].referrer }
106
+ def extract_request_data(payload)
107
+ if payload[:request].is_a?(ActionDispatch::Request)
108
+ data = {}
109
+
110
+ data[:referrer] = payload[:request].referrer if payload[:request].referrer
111
+ data[:host] = payload[:request].host
112
+ data[:user_agent] = payload[:request].user_agent
113
+
114
+ return data
109
115
  end
110
116
 
111
117
  {}
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Heavylog
4
- VERSION = "0.0.21"
4
+ VERSION = "0.0.22"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heavylog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.21
4
+ version: 0.0.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kristjan Rang