Skip to content

AWS ElasticSerch #32

Closed
Closed
@yasin-amadmia-mck

Description

@yasin-amadmia-mck

Hi, Trying this

import logging
from cmreslogging.handlers import CMRESHandler

handler = CMRESHandler(hosts=[{'host': 'http://search-xxxx.es.amazonaws.com', 'port': 80}],
                           auth_type=CMRESHandler.AuthType.AWS_SIGNED_AUTH,
                           use_ssl=False,
                           verify_ssl =False,
                           aws_secret_key='xxxxx',
                           aws_access_key='xxxx',
                           aws_region='eu-west-2',
                           es_index_name="my_python_index")
log = logging.getLogger("PythonTest")
log.setLevel(logging.INFO)
log.addHandler(handler)

The above fails with error

Traceback (most recent call last):
  File "/Users/x/PycharmProjects/elasticsearch/test.py", line 11, in <module>
    es_index_name="my_python_index")
  File "/Users/x/PycharmProjects/VirtualEnvironments/elasticsearch/lib/python2.7/site-packages/cmreslogging/handlers.py", line 194, in __init__
    'host_ip': socket.gethostbyname(socket.gethostname())})
socket.gaierror: [Errno 8] nodename nor servname provided, or not known
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/__init__.py", line 1666, in shutdown
    h.flush()
  File "/Users/x/PycharmProjects/VirtualEnvironments/elasticsearch/lib/python2.7/site-packages/cmreslogging/handlers.py", line 283, in flush
    if self._timer is not None and self._timer.is_alive():
AttributeError: 'CMRESHandler' object has no attribute '_timer'
Error in sys.exitfunc:
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/__init__.py", line 1666, in shutdown
    h.flush()
  File "/Users/x/PycharmProjects/VirtualEnvironments/elasticsearch/lib/python2.7/site-packages/cmreslogging/handlers.py", line 283, in flush
    if self._timer is not None and self._timer.is_alive():
AttributeError: 'CMRESHandler' object has no attribute '_timer'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions