logjam_agent 0.9.12 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -0
- data/lib/logjam_agent/request.rb +13 -1
- data/lib/logjam_agent/version.rb +1 -1
- data/lib/logjam_agent.rb +6 -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: 5280a58a1c2c44ccacf015d14a112e8ad4875d6e
|
4
|
+
data.tar.gz: 4fa82e320cf620961b277da6738d3ef3f7a1423f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d06732e50a957ace135f09e04dd5ee20d968b6265f49e1d21654818d0f5a43bbb8cbc2824ec88e1a32515dff952248d30f9c5c845a2f71c77d8c967f83cd57ed
|
7
|
+
data.tar.gz: dde6c145c7fc906bb2de41b1dfff97d150924d36f81e52383e1314efa322bdf94d00e53ab4f300f1167300b9405898ce7c76c45b02b396c98ed2f9629cfea1c8
|
data/README.md
CHANGED
@@ -55,6 +55,14 @@ module LogjamAgent
|
|
55
55
|
# Configure lines which will not be logged locally.
|
56
56
|
# They will still be sent to the logjam server. Defaults to nil.
|
57
57
|
# self.log_device_ignored_lines = /^\s*Rendered/
|
58
|
+
|
59
|
+
# Configure maximum log line length. Defaults to 2048.
|
60
|
+
# This setting only applies to the lines sent with the request.
|
61
|
+
self.max_line_length = 2048
|
62
|
+
|
63
|
+
# Configure max bytes allowed for all log lines. Defaults to 1Mb.
|
64
|
+
# This setting only applies to the lines sent with the request.
|
65
|
+
self.max_bytes_all_lines = 1024 * 1024
|
58
66
|
end
|
59
67
|
```
|
60
68
|
|
data/lib/logjam_agent/request.rb
CHANGED
@@ -17,6 +17,9 @@ module LogjamAgent
|
|
17
17
|
@fields = initial_fields.merge(:request_id => @uuid, :host => LogjamAgent.hostname, :process_id => Process.pid, :lines => @lines)
|
18
18
|
@mutex = Mutex.new
|
19
19
|
@ignored = false
|
20
|
+
@bytes_all_lines = 0
|
21
|
+
@max_bytes_all_lines = LogjamAgent.max_bytes_all_lines
|
22
|
+
@max_line_length = LogjamAgent.max_line_length
|
20
23
|
end
|
21
24
|
|
22
25
|
def ignore!
|
@@ -44,8 +47,17 @@ module LogjamAgent
|
|
44
47
|
end
|
45
48
|
|
46
49
|
def add_line(severity, timestamp, message)
|
50
|
+
return if @bytes_all_lines > @max_bytes_all_lines
|
51
|
+
message = message.strip
|
52
|
+
if message.size > @max_line_length
|
53
|
+
message[(@max_line_length-21)..-1] = " ... [LINE TRUNCATED]"
|
54
|
+
end
|
47
55
|
@mutex.synchronize do
|
48
|
-
@
|
56
|
+
if (@bytes_all_lines += message.bytesize) < @max_bytes_all_lines
|
57
|
+
@lines << [severity, format_time(timestamp), message]
|
58
|
+
else
|
59
|
+
@lines << [severity, format_time(timestamp), "... [LINES DROPPED]"]
|
60
|
+
end
|
49
61
|
end
|
50
62
|
end
|
51
63
|
|
data/lib/logjam_agent/version.rb
CHANGED
data/lib/logjam_agent.rb
CHANGED
@@ -116,6 +116,12 @@ module LogjamAgent
|
|
116
116
|
mattr_accessor :log_device_ignored_lines
|
117
117
|
self.log_device_ignored_lines = nil
|
118
118
|
|
119
|
+
mattr_accessor :max_line_length
|
120
|
+
self.max_line_length = 2048
|
121
|
+
|
122
|
+
mattr_accessor :max_bytes_all_lines
|
123
|
+
self.max_bytes_all_lines = 1024 * 1024
|
124
|
+
|
119
125
|
def self.log_to_log_device?(msg)
|
120
126
|
!(log_device_ignored_lines && msg =~ log_device_ignored_lines)
|
121
127
|
rescue
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logjam_agent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Kaes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|