logstash-logger 0.25.0 → 0.25.1

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: 5e1ac7a22d1e29a706c724c69e31f6d8481af909
4
- data.tar.gz: 87a7b265d354455021af800ae4c22bf28ee8e3cf
3
+ metadata.gz: '02946cc68ecd472a33ee4e20c8b0f9676a35c31e'
4
+ data.tar.gz: 22ebacf159993cebd61ec2f2069c5d35ccb5949e
5
5
  SHA512:
6
- metadata.gz: 9ed6a184198bde25c4a0fdbe0e4b563642e4b62ac343ae9996b07511d1b9295d37d7a5f38bcf950790b92ee1bfc1ababee32631db1f0bfcf5032f092bfd9128c
7
- data.tar.gz: cac8e3fd8a892e38b1f1a01e201bbeb51bad6cb2669adbd5c317b1cedbcf208c60cdd89445e18e16b38e1576473fac104d72f2aa0ead8113455c48f8152e31bf
6
+ metadata.gz: d19465ebd83bb4a0710eac75face6c11287c5737fc8683e79e5b725cd81933082d123d0bcf220ab49b267c693b98f6bffc5300c7c6ceae7a0ad7b350654c3fe6
7
+ data.tar.gz: f1be1a3735cd768d7c53b5d9cdddb34a3fde4e76d0cc6b770f731a70cd5129d1278bd21017634c9af25c99593d7f006d3d9ed2646a4faf7c84e8e454b85a00d8
@@ -1,3 +1,7 @@
1
+ ## 0.25.1
2
+
3
+ - Skip message truncating when there is no message field. [#130](https://github.com/dwbutler/logstash-logger/pull/130)
4
+
1
5
  ## 0.25.0
2
6
 
3
7
  - Drops support for Rails 3.2, MRI Ruby < 2.2, and JRuby 1.7, since these have been EOL'ed.
data/README.md CHANGED
@@ -817,6 +817,7 @@ logger = LogStashLogger.new('localhost', 5228, :tcp)
817
817
  * [Bin Lan](https://github.com/lanxx019)
818
818
  * [Joao Fernandes](https://github.com/jcmfernandes)
819
819
  * [CoolElvis](https://github.com/coolelvis)
820
+ * [Sergey Pyankov](https://github.com/esergion)
820
821
 
821
822
  ## Contributing
822
823
 
@@ -57,7 +57,7 @@ module LogStashLogger
57
57
  event.timestamp = event.timestamp.iso8601(3)
58
58
  end
59
59
 
60
- if LogStashLogger.configuration.max_message_size
60
+ if LogStashLogger.configuration.max_message_size && event['message']
61
61
  event['message'.freeze] = event['message'.freeze].byteslice(0, LogStashLogger.configuration.max_message_size)
62
62
  end
63
63
 
@@ -1,3 +1,3 @@
1
1
  module LogStashLogger
2
- VERSION = "0.25.0"
2
+ VERSION = "0.25.1"
3
3
  end
@@ -68,5 +68,36 @@ describe LogStashLogger::Formatter::Base do
68
68
  expect(event.timestamp).to eq(time.iso8601(3))
69
69
  end
70
70
  end
71
+
72
+ describe "long messages" do
73
+
74
+ context "message field is present" do
75
+ let(:message) { long_message }
76
+
77
+ it "truncates long messages when max_message_size is set" do
78
+ LogStashLogger.configure do |config|
79
+ config.max_message_size = 2000
80
+ end
81
+
82
+ expect(event['message'].size).to eq(2000)
83
+ end
84
+ end
85
+
86
+ context "event without message field" do
87
+ let(:message) do
88
+ { 'test_field' => 'test', 'foo' => 'bar' }
89
+ end
90
+
91
+ it "still works" do
92
+ LogStashLogger.configure do |config|
93
+ config.max_message_size = 2000
94
+ end
95
+
96
+ expect(event['message']).to eq(nil)
97
+ expect(event['test_field']).to eq('test')
98
+ expect(event['foo']).to eq('bar')
99
+ end
100
+ end
101
+ end
71
102
  end
72
103
  end
@@ -1,4 +1,5 @@
1
1
  require 'pry'
2
+ require 'securerandom'
2
3
 
3
4
  require 'simplecov'
4
5
  SimpleCov.start
@@ -102,6 +103,7 @@ RSpec.shared_context 'formatter' do
102
103
  let(:time) { Time.now }
103
104
  let(:progname) { "ruby" }
104
105
  let(:message) { "foo" }
106
+ let(:long_message) { SecureRandom.hex(65537) }
105
107
  let(:hostname) { Socket.gethostname }
106
108
  let(:formatted_message) do
107
109
  subject.call(severity, time, progname, message)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.25.0
4
+ version: 0.25.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Butler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-13 00:00:00.000000000 Z
11
+ date: 2017-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logstash-event