logstasher 1.0.1 → 1.1.0

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
  SHA1:
3
- metadata.gz: f9b2dc63137f4569c51a29a7b5430a59191fa82d
4
- data.tar.gz: 2db33e2d8e21663bde5537c28a655362e5b69e3c
3
+ metadata.gz: a145ef20aa7c10ed9477b6e6bebd87234165f75f
4
+ data.tar.gz: bc3b6bad147c07d139589a5571cc91207fd6bf4b
5
5
  SHA512:
6
- metadata.gz: 5bd3fbf3c1ffd1309958e4bac528d70289910697b3b5f47f0bcf0b3059c1f83d3cf7e4e5444830e9ebb826164db037c733523a87c5dc11d1c1337f379e850c85
7
- data.tar.gz: 65ff96405b9c4cd7cac60384a9da5d0a180c1e50a0b2d2e65b5d1382fb708d7c47511fb996c54503d356c9ebea28f4402ed4e66791e7f58631dbe59de54733b8
6
+ metadata.gz: fce09c9c21ccb9557f4cd3de6dd159f39fd20613c3d5b2720fa103aa36dc85772bb8ca8bd0e212cec7f73036744487780089afb96a2eaaab090609356cf9e443
7
+ data.tar.gz: d23b01e0585845e2cadb57dc01adbf74839c00ef25372a93a9b462b8cdf2721f6d2b09e7fc3d992492597c9088a9814013b42b376013c7c5657dccb319b22dda
@@ -26,7 +26,7 @@ module LogStasher
26
26
  data.merge! runtimes(event)
27
27
  data.merge! extract_data(data)
28
28
  data.merge! request_context
29
- # data.merge! store
29
+ data.merge! LogStasher.store
30
30
  data.merge! extract_custom_fields(data)
31
31
 
32
32
  tags = []
@@ -29,6 +29,7 @@ module LogStasher
29
29
  data.merge! runtimes(event)
30
30
  data.merge! extract_sql(data)
31
31
  data.merge! request_context
32
+ data.merge! LogStasher.store
32
33
  data.merge! extract_custom_fields(data)
33
34
 
34
35
  tags = [ 'request' ]
@@ -15,6 +15,7 @@ module LogStasher
15
15
  data.merge! runtimes(event)
16
16
  data.merge! location(event)
17
17
  data.merge! extract_exception(payload)
18
+ data.merge! LogStasher.store
18
19
  data.merge! extract_custom_fields(payload)
19
20
 
20
21
  tags = ['request']
@@ -86,7 +87,7 @@ module LogStasher
86
87
  def extract_exception(payload)
87
88
  if payload[:exception]
88
89
  exception, message = payload[:exception]
89
- status = ActionDispatch::ExceptionWrapper.status_code_for_exception(exception)
90
+ status = ::ActionDispatch::ExceptionWrapper.status_code_for_exception(exception)
90
91
  if LogStasher.backtrace
91
92
  backtrace = $!.backtrace.join("\n")
92
93
  else
@@ -42,7 +42,6 @@ module ActionController
42
42
  LogStasher.request_context.each do |key, value|
43
43
  payload[key] = value
44
44
  end
45
- LogStasher::CustomFields.clear
46
45
  result
47
46
  end
48
47
  end
@@ -1,3 +1,3 @@
1
1
  module LogStasher
2
- VERSION = "1.0.1"
2
+ VERSION = "1.1.0"
3
3
  end
data/lib/logstasher.rb CHANGED
@@ -17,7 +17,7 @@ module LogStasher
17
17
  REQUEST_CONTEXT_KEY = :logstasher_request_context
18
18
 
19
19
  attr_accessor :logger, :logger_path, :enabled, :log_controller_parameters, :source, :backtrace,
20
- :controller_monkey_patch
20
+ :controller_monkey_patch, :field_renaming
21
21
  # Setting the default to 'unknown' to define the default behaviour
22
22
  @source = 'unknown'
23
23
  # By default log the backtrace of exceptions
@@ -112,6 +112,7 @@ module LogStasher
112
112
  self.backtrace = !! config.backtrace unless config.backtrace.nil?
113
113
  self.set_data_for_rake
114
114
  self.set_data_for_console
115
+ self.field_renaming = Hash(config.field_renaming)
115
116
  end
116
117
 
117
118
  def set_data_for_rake
@@ -177,6 +178,9 @@ module LogStasher
177
178
  end
178
179
 
179
180
  def build_logstash_event(data, tags)
181
+ field_renaming.each do |old_name, new_name|
182
+ data[new_name] = data.delete(old_name) if data.key?(old_name)
183
+ end
180
184
  ::LogStash::Event.new(data.merge('source' => self.source, 'tags' => tags))
181
185
  end
182
186
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstasher
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shadab Ahmed
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-23 00:00:00.000000000 Z
11
+ date: 2016-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logstash-event