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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6dfcb7af64eb44ded509098ca04f6def5d1c2fca
4
- data.tar.gz: 6bfd5d1d56e2b608ba27fc866d6b714839b0644d
3
+ metadata.gz: 36d2906b6e8ff9b51db9a472c512b2aeafb6dedf
4
+ data.tar.gz: 66f34d334d3307b8fbf6914524075b30a710b05a
5
5
  SHA512:
6
- metadata.gz: 92c40ae9eeb45838e8ee31e9d2919f16e0108051380fab04bb301d6555370dc44f2b08d45bf53049a194c086ddd767922f221d9af1c2ec9cc76b8aceb3e8632a
7
- data.tar.gz: 4542fccf0d1ea09e5a155bd6fd70877e8895a47346e80be64dae7348ab23536cfefc27af815c70e557488653390967739f500dea8360b97d0e9750ab58366724
6
+ metadata.gz: 3bf9637ef2d3247a19c9a3a89ae3e071a6361ff33f73f626c5b7a8a04d20cf507ccb4544adc46eebeee23220554c4d35605ded2a7250041f1264639d5ffe4a48
7
+ data.tar.gz: 0db38d50299bd8a6428fbcbe989c8e3ff39f0010cb13fe07242a7b5da44d424ffd922f267d390889d6f9d99769e4fde1f3b68a5080ef9dd228151a82874aeb04
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -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 -f ' + logfile
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.0
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 and can trigger an event using
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