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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3f89e8dab06c035772e2cb51c4b28d57b03f5909
4
- data.tar.gz: adddab6424954392a6b5c073cea7a65fefe2ae1a
3
+ metadata.gz: 5280a58a1c2c44ccacf015d14a112e8ad4875d6e
4
+ data.tar.gz: 4fa82e320cf620961b277da6738d3ef3f7a1423f
5
5
  SHA512:
6
- metadata.gz: 04cb99940ad5b20d1e65aa94b7c4e29a128c34bc09c3cae44e9d8d1f18af8a4330775c33da4a329635723c5135039176101d5a5cde2e747c854e760e3ffd1960
7
- data.tar.gz: 7c51e5bc69d9e6564537614e51ebd21391491f50670de373418e00c9ea60340746daf6b1af62c9d65b7c7a85d1419b710188e385c4c0a3de1f816e736551444e
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
 
@@ -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
- @lines << [severity, format_time(timestamp), message.strip]
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
 
@@ -1,3 +1,3 @@
1
1
  module LogjamAgent
2
- VERSION = "0.9.12"
2
+ VERSION = "0.10.0"
3
3
  end
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.9.12
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-05-16 00:00:00.000000000 Z
11
+ date: 2014-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake