peastash 0.1.1 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +2 -0
- data/lib/peastash/log_device.rb +15 -0
- data/lib/peastash/outputs/io.rb +2 -2
- data/lib/peastash/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 571c31d67c9ad7ddfaf9653838e188d6d71c1769
|
4
|
+
data.tar.gz: 9d1c5dd762ed5c82a2cf904299b08f34ea7e77e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8435dd2695781fe10774119e7d1ebd36563ddbe41c5f401883484cbd3996899456ab5fd75c67db83bfb52d4ab5a0c69a5ee1e66fed52a421bd7b4cc51f69d163
|
7
|
+
data.tar.gz: 458cd115a2715bf865ba6c008a09caed810ed501b43f60d62683d74c4424c18e4f086d42b8d20305a89a001b43dc2962526398ff75e677ed8c87870a9974929b
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -64,6 +64,8 @@ Please note that this is a global setting and cannot be set per-instance.
|
|
64
64
|
#### Outputs
|
65
65
|
|
66
66
|
Peastash ships with a single output: ``Peastash::Outputs::IO``. It can be initialized either by passing it a path or an IO object.
|
67
|
+
If the argument is a path to a non-writeable file, Peastash will attempt to delete the file to re-create it with the proper permissions.
|
68
|
+
|
67
69
|
Peastash can easily be extended to output to any target.
|
68
70
|
Simply configure Peastash's output with an object that responds to the ``#dump`` method. This method will be called at the end of the ``#log`` block, with 1 argument: a ``LogStash::Event`` object that you will probably need to serialize to json.
|
69
71
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'logger'
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
class Peastash
|
5
|
+
class LogDevice < ::Logger::LogDevice
|
6
|
+
def open_logfile(filename)
|
7
|
+
super
|
8
|
+
rescue Errno::EACCES
|
9
|
+
stat_data = File.stat(filename) rescue nil
|
10
|
+
STDERR.puts "[#{Time.now}][#{Process.pid}] Could not open #{filename} for writing, recreating it. Info: #{stat_data.inspect}"
|
11
|
+
FileUtils.rm(filename)
|
12
|
+
create_logfile(filename)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/peastash/outputs/io.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'peastash/log_device'
|
2
2
|
|
3
3
|
class Peastash
|
4
4
|
module Outputs
|
@@ -10,7 +10,7 @@ class Peastash
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def initialize(file)
|
13
|
-
@device =
|
13
|
+
@device = ::Peastash::LogDevice.new(file)
|
14
14
|
end
|
15
15
|
|
16
16
|
def dump(event)
|
data/lib/peastash/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: peastash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vincent Boisard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logstash-event
|
@@ -168,6 +168,7 @@ files:
|
|
168
168
|
- gemfiles/Gemfile.rails-4.2.x
|
169
169
|
- gemfiles/Gemfile.rails-head
|
170
170
|
- lib/peastash.rb
|
171
|
+
- lib/peastash/log_device.rb
|
171
172
|
- lib/peastash/middleware.rb
|
172
173
|
- lib/peastash/outputs/io.rb
|
173
174
|
- lib/peastash/rails_ext.rb
|
@@ -390,3 +391,4 @@ test_files:
|
|
390
391
|
- spec/peastash/rails_ext/watch_spec.rb
|
391
392
|
- spec/peastash_spec.rb
|
392
393
|
- spec/spec_helper.rb
|
394
|
+
has_rdoc:
|