imprint 1.1.4 → 1.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -72,6 +72,23 @@ def log(message = nil, severity = :info)
72
72
  end
73
73
  ```
74
74
 
75
+ ## Optional Helpers
76
+
77
+ You can get a configurable log entrypoint for apps that allows for some intial logging on each request. This is intended to work well and be combined with lograge, but can be helpful on its own. To use the helpers follow the steps below.
78
+
79
+ edit `config/application.rb` and append the lines below, with whatever options make sense for your projects:
80
+
81
+ require 'imprint/log_helpers'
82
+
83
+ # we are using a blacklist on headers opposed to a whitelist
84
+ HEADERS_TO_IGNORE = ['HTTP_COOKIE', 'HTTP_ACCEPT_ENCODING', 'HTTP_HOST', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_REAL_IP', 'HTTP_VERSION', 'HTTP_X_FORWARDED_PROTO', 'HTTP_HOST', 'HTTP_CONNECTION', 'HTTP_CACHE_CONTROL', 'HTTP_ACCEPT', 'HTTP_ACCEPT_ENCODING', 'HTTP_X_AKAMAI_EDGESCAPE', 'HTTP_AKAMAI_ORIGIN_HOP', 'HTTP_TE', 'HTTP_CLIENT_IP', 'HTTP_PRAGMA', 'HTTP_X_AKAMAI_CONFIG_LOG_DETAIL', 'HTTP_X_HTTPS', 'HTTP_X_REQUESTED_WITH', 'HTTP_VIA', 'HTTP_X_NEWRELIC_TRANSACTION', 'HTTP_AUTHORIZATION', 'HTTP_IF_MODIFIED_SINCE', 'HTTP_X_LS_MERCHANT_API_KEY', 'HTTP_X_CNECTION', 'HTTP_X_LIVINGSOCIAL_AUTH_TOKEN']
85
+ Imprint.configure({
86
+ :log_filters => Rails.application.config.filter_parameters + ['some_other_token'],
87
+ :header_blacklist => HEADERS_TO_IGNORE,
88
+ :variables_to_append => ['viewer'],
89
+ :cookies_whitelist => ['living_social_user_id']
90
+ })
91
+
75
92
  ## Example Queries
76
93
 
77
94
  These queries should work in Kibana/ElasticSearch, Splunk, or other log solutions. We may need to support different output formatters in the future depending on how various logging systems handle default field extraction.
@@ -14,7 +14,11 @@ module Imprint
14
14
 
15
15
  http_request_headers = request.headers.select{|header_name, header_value| header_name.match("^HTTP.*") && !header_blacklist.include?(header_name) }
16
16
  data_append = "headers: "
17
- http_request_headers.each_pair{|k,v| data_append << " #{k}=\"#{v}\"" }
17
+ if http_request_headers.respond_to?(:each_pair)
18
+ http_request_headers.each_pair{|k,v| data_append << " #{k}=\"#{v}\"" }
19
+ else
20
+ http_request_headers.each{|el| data_append << " #{el.first}=\"#{el.last}\"" }
21
+ end
18
22
 
19
23
  data_append << " params: "
20
24
  log_filter.filter(params).each_pair{|k,v| data_append << " #{k}=\"#{v}\"" }
@@ -1,3 +1,3 @@
1
1
  module Imprint
2
- VERSION = "1.1.4"
2
+ VERSION = "1.1.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: imprint
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.1.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -147,7 +147,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
147
147
  version: '0'
148
148
  segments:
149
149
  - 0
150
- hash: -3977275337200593217
150
+ hash: 4420321569846472065
151
151
  required_rubygems_version: !ruby/object:Gem::Requirement
152
152
  none: false
153
153
  requirements:
@@ -156,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
156
  version: '0'
157
157
  segments:
158
158
  - 0
159
- hash: -3977275337200593217
159
+ hash: 4420321569846472065
160
160
  requirements: []
161
161
  rubyforge_project:
162
162
  rubygems_version: 1.8.23