logstash-lite 0.2.20101124030048 → 0.2.20101129155412

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -49,8 +49,8 @@ class LogStash::Filters::Date < LogStash::Filters::Base
49
49
  end
50
50
  event.timestamp = LogStash::Time.to_iso8601(time)
51
51
  @logger.debug "Parsed #{value.inspect} as #{event.timestamp}"
52
- rescue
53
- @logger.warn "Failed parsing date #{value.inspect} from field #{field} with format #{format.inspect}: #{$!}"
52
+ rescue => e
53
+ @logger.warn "Failed parsing date #{value.inspect} from field #{field} with format #{format.inspect}: #{e}"
54
54
  end
55
55
  end # fieldvalue.each
56
56
  end # if this event has a field we expect to be a timestamp
@@ -11,9 +11,11 @@ class LogStash::Outputs::Websocket < LogStash::Outputs::Base
11
11
  @subscribers = 0
12
12
  host = (@url.host or "0.0.0.0")
13
13
  port = (@url.port or 3000)
14
+ @logger.info("Registering websocket on #{@url}")
14
15
  EventMachine::WebSocket.start(:host => host, :port => port) do |ws|
15
16
  ws.onopen do
16
17
  @subscribers += 1
18
+ @logger.info("New #{self.class.name} connection")
17
19
  sid = @channel.subscribe do |msg|
18
20
  ws.send msg
19
21
  end
@@ -29,6 +31,7 @@ class LogStash::Outputs::Websocket < LogStash::Outputs::Base
29
31
  # Only publish the event to websockets if there are subscribers
30
32
  # TODO(sissel): send a patch to eventmachine to fix this.
31
33
  if @subscribers > 0
34
+ @logger.info("Sending event to websocket.")
32
35
  @channel.push event.to_json
33
36
  end
34
37
  end # def event
data/lib/logstash/time.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require "logstash/namespace"
2
+ require "date" # for DateTime
2
3
 
3
4
  # Provide our own Time wrapper for ISO8601 support
4
5
  # Example:
@@ -45,19 +45,20 @@
45
45
 
46
46
  <script id="message-template" type="text/x-jquery-tmpl"><![CDATA[
47
47
  <tr>
48
- <td class="timestamp">${received_timestamp}</td>
49
- <td class="message">${message}</td>
48
+ <td class="timestamp">${$item.data["@timestamp"]}</td>
49
+ <td class="message">${$item.data["@message"]}</td>
50
50
  </tr>
51
51
  ]]></script>
52
52
 
53
53
  <script>
54
54
  $(document).ready(function() {
55
- var ws = new WebSocket("ws://snack.home:3000");
55
+ var ws = new WebSocket("ws://" + document.location.hostname + ":3232");
56
+ ws.onopen = function(event) {
57
+ //console.log(["WebSocket open", ws])
58
+ };
56
59
  ws.onmessage = function(event) {
57
60
  eval("var data = " + event.data);
58
- //var el = $("<div></div>")
59
- //el.html(data.message)
60
- var el = $("#message-template").tmpl(data);
61
+ var el = $("#message-template").tmpl(data, { "message": data["@message"], "timestamp": data["@timestamp"] });
61
62
  el.addClass("message")
62
63
  .css("display", "none")
63
64
  .appendTo($("#radiator"))
@@ -66,7 +67,7 @@
66
67
  .fadeOut(2000, function() {
67
68
  $(this).remove();
68
69
  });
69
- }
70
+ };
70
71
  });
71
72
  </script>
72
73
  </body>
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-lite
3
3
  version: !ruby/object:Gem::Version
4
- hash: 40202248060119
4
+ hash: 40202258310847
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 20101124030048
10
- version: 0.2.20101124030048
9
+ - 20101129155412
10
+ version: 0.2.20101129155412
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jordan Sissel
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-24 00:00:00 -08:00
18
+ date: 2010-11-29 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency