Lazily connect to logstash
Because boot order is such a mess we will lazily connect to the logstash TCP/UDP ports to allow for logstash to come up before we start writing to it. This takes advantage of existing logstash restart handler code in the log processors. Change-Id: I836c55806c88cc86b7973b3d40f4bfce076970f5
This commit is contained in:
parent
3cd22c77cc
commit
2aa7b07ebb
@ -299,7 +299,7 @@ class INETLogProcessor(object):
|
||||
self.logq = logq
|
||||
self.host = host
|
||||
self.port = port
|
||||
self._connect_socket()
|
||||
self.socket = None
|
||||
|
||||
def _connect_socket(self):
|
||||
logging.debug("Creating socket.")
|
||||
@ -309,6 +309,8 @@ class INETLogProcessor(object):
|
||||
def handle_log_event(self):
|
||||
log = self.logq.get()
|
||||
try:
|
||||
if self.socket is None:
|
||||
self._connect_socket()
|
||||
self.socket.sendall((json.dumps(log) + '\n').encode('utf-8'))
|
||||
except:
|
||||
logging.exception("Exception sending INET event.")
|
||||
|
Loading…
x
Reference in New Issue
Block a user