GreyZmeem / python-logging-loki

Python logging handler for Loki
MIT License
151 stars 57 forks source link

SSL Error: Wrong Version Number #26

Open eddysanoli opened 2 years ago

eddysanoli commented 2 years ago

Hello. I'm getting the following error when trying run the default example found in the documentation for this package.

Traceback (most recent call last):
devops-tools             |   File "/root/.local/share/virtualenvs/meraki_gpns_tools-7f3ZpwMf/lib/python3.8/site-packages/logging_loki/handlers.py", line 81, in emit
devops-tools             |     self.emitter(record, self.format(record))
devops-tools             |   File "/root/.local/share/virtualenvs/meraki_gpns_tools-7f3ZpwMf/lib/python3.8/site-packages/logging_loki/emitter.py", line 55, in __call__
devops-tools             |     resp = self.session.post(self.url, json=payload)
devops-tools             |   File "/root/.local/share/virtualenvs/meraki_gpns_tools-7f3ZpwMf/lib/python3.8/site-packages/requests/sessions.py", line 635, in post
devops-tools             |     return self.request("POST", url, data=data, json=json, **kwargs)
devops-tools             |   File "/root/.local/share/virtualenvs/meraki_gpns_tools-7f3ZpwMf/lib/python3.8/site-packages/requests/sessions.py", line 587, in request
devops-tools             |     resp = self.send(prep, **send_kwargs)
devops-tools             |   File "/root/.local/share/virtualenvs/meraki_gpns_tools-7f3ZpwMf/lib/python3.8/site-packages/requests/sessions.py", line 701, in send
devops-tools             |     r = adapter.send(request, **kwargs)
devops-tools             |   File "/root/.local/share/virtualenvs/meraki_gpns_tools-7f3ZpwMf/lib/python3.8/site-packages/requests/adapters.py", line 563, in send
devops-tools             |     raise SSLError(e, request=request)
devops-tools             | requests.exceptions.SSLError: HTTPSConnectionPool(host='devops-tools-loki', port=3100): Max retries exceeded with url: /loki/api/v1/push (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1131)')))
devops-tools             | Call stack:
devops-tools             |   File "/usr/local/lib/python3.8/threading.py", line 890, in _bootstrap
devops-tools             |     self._bootstrap_inner()
devops-tools             |   File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner
devops-tools             |     self.run()
devops-tools             |   File "/usr/local/lib/python3.8/threading.py", line 870, in run
devops-tools             |     self._target(*self._args, **self._kwargs)
devops-tools             |   File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 80, in _worker
devops-tools             |     work_item.run()
devops-tools             |   File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
devops-tools             |     result = self.fn(*self.args, **self.kwargs)
devops-tools             |   File "/root/.local/share/virtualenvs/meraki_gpns_tools-7f3ZpwMf/lib/python3.8/site-packages/asgiref/sync.py", line 486, in thread_handler
devops-tools             |     return func(*args, **kwargs)
devops-tools             |   File "/root/.local/share/virtualenvs/meraki_gpns_tools-7f3ZpwMf/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
devops-tools             |     response = get_response(request)
devops-tools             |   File "/root/.local/share/virtualenvs/meraki_gpns_tools-7f3ZpwMf/lib/python3.8/site-packages/django/utils/deprecation.py", line 117, in __call__
devops-tools             |     response = response or self.get_response(request)
devops-tools             |   File "/root/.local/share/virtualenvs/meraki_gpns_tools-7f3ZpwMf/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
devops-tools             |     response = get_response(request)
devops-tools             |   File "/root/.local/share/virtualenvs/meraki_gpns_tools-7f3ZpwMf/lib/python3.8/site-packages/django/utils/deprecation.py", line 117, in __call__
devops-tools             |     response = response or self.get_response(request)
devops-tools             |   File "/root/.local/share/virtualenvs/meraki_gpns_tools-7f3ZpwMf/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
devops-tools             |     response = get_response(request)
devops-tools             |   File "/root/.local/share/virtualenvs/meraki_gpns_tools-7f3ZpwMf/lib/python3.8/site-packages/django/utils/deprecation.py", line 117, in __call__
devops-tools             |     response = response or self.get_response(request)
devops-tools             |   File "/root/.local/share/virtualenvs/meraki_gpns_tools-7f3ZpwMf/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
devops-tools             |     response = get_response(request)
devops-tools             |   File "/root/.local/share/virtualenvs/meraki_gpns_tools-7f3ZpwMf/lib/python3.8/site-packages/django/utils/deprecation.py", line 117, in __call__
devops-tools             |     response = response or self.get_response(request)
devops-tools             |   File "/root/.local/share/virtualenvs/meraki_gpns_tools-7f3ZpwMf/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
devops-tools             |     response = get_response(request)
devops-tools             |   File "/root/.local/share/virtualenvs/meraki_gpns_tools-7f3ZpwMf/lib/python3.8/site-packages/django/utils/deprecation.py", line 117, in __call__
devops-tools             |     response = response or self.get_response(request)
devops-tools             |   File "/root/.local/share/virtualenvs/meraki_gpns_tools-7f3ZpwMf/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
devops-tools             |     response = get_response(request)
devops-tools             |   File "/root/.local/share/virtualenvs/meraki_gpns_tools-7f3ZpwMf/lib/python3.8/site-packages/django/utils/deprecation.py", line 117, in __call__
devops-tools             |     response = response or self.get_response(request)
devops-tools             |   File "/root/.local/share/virtualenvs/meraki_gpns_tools-7f3ZpwMf/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
devops-tools             |     response = get_response(request)
devops-tools             |   File "/root/.local/share/virtualenvs/meraki_gpns_tools-7f3ZpwMf/lib/python3.8/site-packages/django/utils/deprecation.py", line 117, in __call__
devops-tools             |     response = response or self.get_response(request)
devops-tools             |   File "/root/.local/share/virtualenvs/meraki_gpns_tools-7f3ZpwMf/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
devops-tools             |     response = get_response(request)
devops-tools             |   File "/root/.local/share/virtualenvs/meraki_gpns_tools-7f3ZpwMf/lib/python3.8/site-packages/django/utils/deprecation.py", line 117, in __call__
devops-tools             |     response = response or self.get_response(request)
devops-tools             |   File "/root/.local/share/virtualenvs/meraki_gpns_tools-7f3ZpwMf/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
devops-tools             |     response = get_response(request)
devops-tools             |   File "/root/.local/share/virtualenvs/meraki_gpns_tools-7f3ZpwMf/lib/python3.8/site-packages/django/utils/deprecation.py", line 117, in __call__
devops-tools             |     response = response or self.get_response(request)
devops-tools             |   File "/root/.local/share/virtualenvs/meraki_gpns_tools-7f3ZpwMf/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
devops-tools             |     response = get_response(request)
devops-tools             |   File "/root/.local/share/virtualenvs/meraki_gpns_tools-7f3ZpwMf/lib/python3.8/site-packages/django/utils/deprecation.py", line 117, in __call__
devops-tools             |     response = response or self.get_response(request)
devops-tools             |   File "/root/.local/share/virtualenvs/meraki_gpns_tools-7f3ZpwMf/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
devops-tools             |     response = get_response(request)
devops-tools             |   File "/root/.local/share/virtualenvs/meraki_gpns_tools-7f3ZpwMf/lib/python3.8/site-packages/ms_identity_web/django/middleware.py", line 32, in __call__
devops-tools             |     response = self.get_response(request)
devops-tools             |   File "/root/.local/share/virtualenvs/meraki_gpns_tools-7f3ZpwMf/lib/python3.8/site-packages/asgiref/sync.py", line 202, in __call__
devops-tools             |     current_executor.run_until_future(loop_future)
devops-tools             |   File "/root/.local/share/virtualenvs/meraki_gpns_tools-7f3ZpwMf/lib/python3.8/site-packages/asgiref/current_thread_executor.py", line 62, in run_until_future
devops-tools             |     work_item.run()
devops-tools             |   File "/root/.local/share/virtualenvs/meraki_gpns_tools-7f3ZpwMf/lib/python3.8/site-packages/asgiref/current_thread_executor.py", line 22, in run
devops-tools             |     result = self.fn(*self.args, **self.kwargs)
devops-tools             |   File "/root/.local/share/virtualenvs/meraki_gpns_tools-7f3ZpwMf/lib/python3.8/site-packages/asgiref/sync.py", line 486, in thread_handler
devops-tools             |     return func(*args, **kwargs)
devops-tools             |   File "/opt/meraki_gpns_tools/automationproject/decorators.py", line 65, in wrap
devops-tools             |     return function(request, user=user_object, *args, **kwargs)
devops-tools             |   File "/opt/meraki_gpns_tools/automationproject/decorators.py", line 28, in wrap
devops-tools             |     return function(request, api_key=meraki_key, *args, **kwargs)
devops-tools             |   File "/opt/meraki_gpns_tools/unonetapp/views.py", line 86, in onboardingView
devops-tools             |     logger.error(
devops-tools             |   File "/usr/local/lib/python3.8/logging/__init__.py", line 1475, in error
devops-tools             |     self._log(ERROR, msg, args, **kwargs)
devops-tools             |   File "/usr/local/lib/python3.8/logging/__init__.py", line 1589, in _log
devops-tools             |     self.handle(record)
devops-tools             |   File "/usr/local/lib/python3.8/logging/__init__.py", line 1599, in handle
devops-tools             |     self.callHandlers(record)
devops-tools             |   File "/usr/local/lib/python3.8/logging/__init__.py", line 1661, in callHandlers
devops-tools             |     hdlr.handle(record)
devops-tools             |   File "/usr/local/lib/python3.8/logging/__init__.py", line 954, in handle
devops-tools             |     self.emit(record)
devops-tools             |   File "/root/.local/share/virtualenvs/meraki_gpns_tools-7f3ZpwMf/lib/python3.8/site-packages/logging_loki/handlers.py", line 83, in emit
devops-tools             |     self.handleError(record)
devops-tools             | Message: 'Something happened'
devops-tools             | Arguments: ()

Apparently I'm using a wrong SSL version, but I dont have the slightest idea of what that means.

xulligan2 commented 2 years ago

Hi @eddysanoli, maybe your URL is https instead of http ?