syslogstash 0.1.5 → 0.2.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: 1146e4aa94b87702bcc7859071f330a0dc82217b
4
- data.tar.gz: 7e309b2725310d9353486caf3e39083c92cc10ff
3
+ metadata.gz: 85063132d60f932f245cee23fe386113bd2a470b
4
+ data.tar.gz: c4316c6c14830d325ee405dd30dabd26cd022071
5
5
  SHA512:
6
- metadata.gz: f1c11c88ca4b5d27e0c9bb10b7e9438acf1e9f199f1053d5ebf8e60d4266224218d388afda093f755b3596e3a686316b06d54b2370459012ae5e7b5b04708eda
7
- data.tar.gz: df55bd4d65f556b60fc2eb3fe229a5f0cf6af00b7cad19971fa47fb60cf14e1852cbb0bc014070d741c9280e2d1a31db2d404e0cc56ec49a1ef044d3c4be8645
6
+ metadata.gz: 726a84230a8d06d8fd1889a4e3d915aa9b1e662657b1d7f460f969aae34a1c3e74bba0e80eb962793547ff2ca0b0930926cdad7528a010b42eb5d9581b191f45
7
+ data.tar.gz: f4bbc3b3abfd71c74c05f5ba449081b8cff1c393f4862f94dcf00f156ac74ac5ba1cd4f8998aa4ea42d9bafdf3bf576e61d956e7eb1c15fbc6152e0cd00ac85a
data/bin/syslogstash CHANGED
@@ -48,4 +48,4 @@ end
48
48
  end
49
49
  end
50
50
 
51
- Syslogstash.new(cfg['sockets'], cfg['servers']).run
51
+ Syslogstash.new(cfg['sockets'], cfg['servers'], cfg.fetch('backlog', 1_000_000)).run
@@ -10,8 +10,8 @@ class Syslogstash::LogstashWriter
10
10
  # Give it a list of servers, and your writer will be ready to go.
11
11
  # No messages will actually be *delivered*, though, until you call #run.
12
12
  #
13
- def initialize(servers)
14
- @servers = servers.map { |s| URI(s) }
13
+ def initialize(servers, backlog)
14
+ @servers, @backlog = servers.map { |s| URI(s) }, @backlog
15
15
 
16
16
  unless @servers.all? { |url| url.scheme == 'tcp' }
17
17
  raise ArgumentError,
@@ -27,7 +27,10 @@ class Syslogstash::LogstashWriter
27
27
  # #run.
28
28
  #
29
29
  def send_entry(e)
30
- @entries_mutex.synchronize { @entries << e }
30
+ @entries_mutex.synchronize do
31
+ @entries << e
32
+ @entries.shift while @entries.length > @backlog
33
+ end
31
34
  @worker.run if @worker
32
35
  end
33
36
 
data/lib/syslogstash.rb CHANGED
@@ -6,8 +6,8 @@ require 'json'
6
6
  # server.
7
7
  #
8
8
  class Syslogstash
9
- def initialize(sockets, servers)
10
- @writer = LogstashWriter.new(servers)
9
+ def initialize(sockets, servers, backlog)
10
+ @writer = LogstashWriter.new(servers, backlog)
11
11
 
12
12
  @readers = sockets.map { |f, tags| SyslogReader.new(f, tags, @writer) }
13
13
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: syslogstash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Palmer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-14 00:00:00.000000000 Z
11
+ date: 2016-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler