cmanaha / python-elasticsearch-logger

Python Elasticsearch handler for the standard python logging framework
Other
232 stars 116 forks source link

ImportError: cannot import name 'RequestsHttpConnection' from 'elasticsearch' #91

Open ffMathy opened 1 year ago

ffMathy commented 1 year ago

I am getting the following error when I try to use the package:

File "/usr/local/lib/python3.7/site-packages/elasticecslogging/handlers.py", line 14, in from elasticsearch import Elasticsearch, RequestsHttpConnection ImportError: cannot import name 'RequestsHttpConnection' from 'elasticsearch' (/usr/local/lib/python3.7/site-packages/elasticsearch/init.py)

Here's my requirements.txt:

ftrack-python-api==2.3.0
ElasticECSHandler==1.0.3
elasticsearch==8.6.2
requests==2.28.2
thoscilo commented 1 year ago

Hi,

As a quick W/A I have set elasticsearch to last 7.x version in PR #92.

Another, local W/A is to call:

pip uninstall elasticsearch
pip install elasticsearch==7.17.9
drumadrian commented 1 year ago

Hi @ffMathy

Did the recommended workaround from @thoscilo help?

ffMathy commented 1 year ago

I can't downgrade to 7 unfortunately.

thoscilo commented 1 year ago

@ffMathy, @drumadrian - I have managed locally fix this problem and update the usage of elasticsearch in version 8.X and successfully ingested logs to my ELK stack.

Right now I was able to test it with my custom auth method (LDAP with login and password provided directly - in plans to add as new PR too).

I will test other auth methods and create fix PR with result's.

thoscilo commented 1 year ago

@ffMathy, @drumadrian - you can check the #93 PR. It should fix the original problem reported.