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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +1 -0
- data/lib/logstash-logger/formatter/base.rb +1 -1
- data/lib/logstash-logger/version.rb +1 -1
- data/spec/formatter/base_spec.rb +31 -0
- data/spec/spec_helper.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '02946cc68ecd472a33ee4e20c8b0f9676a35c31e'
|
4
|
+
data.tar.gz: 22ebacf159993cebd61ec2f2069c5d35ccb5949e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d19465ebd83bb4a0710eac75face6c11287c5737fc8683e79e5b725cd81933082d123d0bcf220ab49b267c693b98f6bffc5300c7c6ceae7a0ad7b350654c3fe6
|
7
|
+
data.tar.gz: f1be1a3735cd768d7c53b5d9cdddb34a3fde4e76d0cc6b770f731a70cd5129d1278bd21017634c9af25c99593d7f006d3d9ed2646a4faf7c84e8e454b85a00d8
|
data/CHANGELOG.md
CHANGED
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
|
|
data/spec/formatter/base_spec.rb
CHANGED
@@ -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
|
data/spec/spec_helper.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2017-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logstash-event
|