lognotify 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/lognotify.rb +22 -2
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36d2906b6e8ff9b51db9a472c512b2aeafb6dedf
|
4
|
+
data.tar.gz: 66f34d334d3307b8fbf6914524075b30a710b05a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3bf9637ef2d3247a19c9a3a89ae3e071a6361ff33f73f626c5b7a8a04d20cf507ccb4544adc46eebeee23220554c4d35605ded2a7250041f1264639d5ffe4a48
|
7
|
+
data.tar.gz: 0db38d50299bd8a6428fbcbe989c8e3ff39f0010cb13fe07242a7b5da44d424ffd922f267d390889d6f9d99769e4fde1f3b68a5080ef9dd228151a82874aeb04
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/lognotify.rb
CHANGED
@@ -12,7 +12,7 @@ class LogNotify
|
|
12
12
|
@sps = sps_address ? SPSPub.new(address: sps_address, port: sps_port) : nil
|
13
13
|
@sps_topic = sps_topic
|
14
14
|
|
15
|
-
@command = 'tail -n 1 -
|
15
|
+
@command = 'tail -n 1 -F ' + logfile
|
16
16
|
|
17
17
|
end
|
18
18
|
|
@@ -39,6 +39,26 @@ class LogNotify
|
|
39
39
|
end
|
40
40
|
|
41
41
|
end
|
42
|
+
|
43
|
+
def watch()
|
44
|
+
|
45
|
+
return unless block_given?
|
46
|
+
|
47
|
+
t = Time.now # using the time we can ignore existing entries
|
48
|
+
|
49
|
+
IO.popen(@command).each_line do |x|
|
50
|
+
|
51
|
+
# anything after 5 seconds from start is new
|
52
|
+
if Time.now > t + 5 then
|
53
|
+
|
54
|
+
raw_log_entry = x.lines.last
|
55
|
+
|
56
|
+
#@sps.notice(@sps_topic + ': ' + json) if @sps
|
57
|
+
yield raw_log_entry
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
42
62
|
|
43
63
|
end
|
44
64
|
|
@@ -54,4 +74,4 @@ if __FILE__ == $0 then
|
|
54
74
|
|
55
75
|
ln.start
|
56
76
|
|
57
|
-
end
|
77
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lognotify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -83,6 +83,6 @@ rubyforge_project:
|
|
83
83
|
rubygems_version: 2.4.8
|
84
84
|
signing_key:
|
85
85
|
specification_version: 4
|
86
|
-
summary: Actively monitors a log file for new entries
|
86
|
+
summary: Actively monitors a log file for new entries which can trigger an event using
|
87
87
|
a regular expression
|
88
88
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|