Last active
December 28, 2015 12:49
-
-
Save vmadman/7503376 to your computer and use it in GitHub Desktop.
Revisions
-
vmadman revised this gist
Nov 16, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -16,7 +16,7 @@ class LogStash::Outputs::LogIO < LogStash::Outputs::Base config_name "logio" plugin_status 0 # log.io server host config :host, :validate => :string, :required => true -
vmadman revised this gist
Nov 16, 2013 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,6 +9,10 @@ # Plugin is fault tolerant. If the plugin is unable to connect to the server, # or writes to a broken socket, it will attempt to reconnect indefinitely. # # This logstash plugin was converted to a gist by Luke Chavers <github.com/vmadman> # Source was taken from: https://github.com/msmathers/logstash/blob/develop/log.io/lib/logstash/outputs/logio.rb # See also: http://narrativescience.com/blog/announcing-the-new-log-io/ # class LogStash::Outputs::LogIO < LogStash::Outputs::Base config_name "logio" -
vmadman created this gist
Nov 16, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,57 @@ require "logstash/outputs/base" require "logstash/namespace" require "socket" # Log.io Output # # Sends events to a Log.io server over TCP. # # Plugin is fault tolerant. If the plugin is unable to connect to the server, # or writes to a broken socket, it will attempt to reconnect indefinitely. # class LogStash::Outputs::LogIO < LogStash::Outputs::Base config_name "logio" plugin_status "experimental" # log.io server host config :host, :validate => :string, :required => true # log.io server TCP port config :port, :validate => :number, :default => 28777 # log.io TCP message format config :format, :default => "+log|%{@source}|%{@source_host}|%{@level}|%{@timestamp}: %{@message}\r\n" public def register connect end public def receive(event) return unless output?(event) msg = event.sprintf(@format) send_log(msg) end private def connect begin @sock = TCPSocket.open(@host, @port) rescue sleep(2) connect end end private def send_log(msg) begin @sock.puts msg rescue sleep(2) connect end end end