mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 06:37:19 -04:00
- Small logging changes
This commit is contained in:
parent
f22b6fe93a
commit
85954c4320
2 changed files with 5 additions and 2 deletions
|
@ -49,8 +49,8 @@ class LogStash::Filters::Date < LogStash::Filters::Base
|
|||
end
|
||||
event.timestamp = LogStash::Time.to_iso8601(time)
|
||||
@logger.debug "Parsed #{value.inspect} as #{event.timestamp}"
|
||||
rescue
|
||||
@logger.warn "Failed parsing date #{value.inspect} from field #{field} with format #{format.inspect}: #{$!}"
|
||||
rescue => e
|
||||
@logger.warn "Failed parsing date #{value.inspect} from field #{field} with format #{format.inspect}: #{e}"
|
||||
end
|
||||
end # fieldvalue.each
|
||||
end # if this event has a field we expect to be a timestamp
|
||||
|
|
|
@ -11,9 +11,11 @@ class LogStash::Outputs::Websocket < LogStash::Outputs::Base
|
|||
@subscribers = 0
|
||||
host = (@url.host or "0.0.0.0")
|
||||
port = (@url.port or 3000)
|
||||
@logger.info("Registering websocket on #{@url}")
|
||||
EventMachine::WebSocket.start(:host => host, :port => port) do |ws|
|
||||
ws.onopen do
|
||||
@subscribers += 1
|
||||
@logger.info("New #{self.class.name} connection")
|
||||
sid = @channel.subscribe do |msg|
|
||||
ws.send msg
|
||||
end
|
||||
|
@ -29,6 +31,7 @@ class LogStash::Outputs::Websocket < LogStash::Outputs::Base
|
|||
# Only publish the event to websockets if there are subscribers
|
||||
# TODO(sissel): send a patch to eventmachine to fix this.
|
||||
if @subscribers > 0
|
||||
@logger.info("Sending event to websocket.")
|
||||
@channel.push event.to_json
|
||||
end
|
||||
end # def event
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue