|
@ -33,12 +33,14 @@ class LogzioSender: |
|
|
token, url='https://listener.logz.io:8071', |
|
|
token, url='https://listener.logz.io:8071', |
|
|
logs_drain_timeout=5, |
|
|
logs_drain_timeout=5, |
|
|
debug=False, |
|
|
debug=False, |
|
|
backup_logs=True): |
|
|
|
|
|
|
|
|
backup_logs=True, |
|
|
|
|
|
network_timeout=10.0): |
|
|
self.token = token |
|
|
self.token = token |
|
|
self.url = '{}/?token={}'.format(url, token) |
|
|
self.url = '{}/?token={}'.format(url, token) |
|
|
self.logs_drain_timeout = logs_drain_timeout |
|
|
self.logs_drain_timeout = logs_drain_timeout |
|
|
self.logger = get_logger(debug) |
|
|
self.logger = get_logger(debug) |
|
|
self.backup_logs = backup_logs |
|
|
self.backup_logs = backup_logs |
|
|
|
|
|
self.network_timeout = network_timeout |
|
|
|
|
|
|
|
|
# Function to see if the main thread is alive |
|
|
# Function to see if the main thread is alive |
|
|
self.is_main_thread_active = lambda: any( |
|
|
self.is_main_thread_active = lambda: any( |
|
@ -109,7 +111,8 @@ class LogzioSender: |
|
|
should_retry = False |
|
|
should_retry = False |
|
|
try: |
|
|
try: |
|
|
response = requests.post( |
|
|
response = requests.post( |
|
|
self.url, headers=headers, data='\n'.join(logs_list)) |
|
|
|
|
|
|
|
|
self.url, headers=headers, data='\n'.join(logs_list), |
|
|
|
|
|
timeout=self.network_timeout) |
|
|
if response.status_code != 200: |
|
|
if response.status_code != 200: |
|
|
if response.status_code == 400: |
|
|
if response.status_code == 400: |
|
|
self.logger.info( |
|
|
self.logger.info( |
|
|