jorgebastida / jorgebastida/awslogs

socket.gaierror: [Errno 8] nodename nor servname provided, or not known

Open
#356 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
5k
Forks
342
PR merge metrics
No merged PRs in 30d

Description

Version: 0.14.0
Python: 3.9.5 (default, May 3 2021, 19:12:05)
[Clang 12.0.5 (clang-1205.0.22.9)]
boto3 version: 1.14.20
Platform: macOS-11.5-arm64-arm-64bit
Args: ['/opt/homebrew/bin/awslogs', 'get', '/aws/lambda/XXXXX-z68xVAcjbqrp', 'ALL', '--watch']
Config: {'aws_access_key_id': 'SENSITIVE', 'aws_secret_access_key': 'SENSITIVE', 'aws_session_token': 'SENSITIVE', 'aws_profile': 'SENSITIVE', 'aws_region': 'us-east-1', 'aws_endpoint_url': None, 'log_group_name': '/aws/lambda/XXXX-z68xVAcjbqrp', 'log_stream_name': 'ALL', 'filter_pattern': None, 'watch': True, 'watch_interval': 1, 'output_group_enabled': True, 'output_stream_enabled': True, 'output_timestamp_enabled': False, 'output_ingestion_time_enabled': False, 'start': '5m', 'end': None, 'color': 'auto', 'query': None, 'func': 'list_logs'}

Traceback (most recent call last):
File "/opt/homebrew/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/urllib3/connection.py", line 159, in _new_conn
conn = connection.create_connection(
File "/opt/homebrew/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/urllib3/util/connection.py", line 61, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
File "/opt/homebrew/Cellar/python@3.9/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socket.py", line 953, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 8] nodename nor servname provided, or not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/homebrew/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/botocore/httpsession.py", line 254, in send
urllib_response = conn.urlopen(
File "/opt/homebrew/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/urllib3/connectionpool.py", line 724, in urlopen
retries = retries.increment(
File "/opt/homebrew/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/urllib3/util/retry.py", line 379, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/opt/homebrew/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/urllib3/packages/six.py", line 735, in reraise
raise value
File "/opt/homebrew/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/urllib3/connectionpool.py", line 670, in urlopen
httplib_response = self._make_request(
File "/opt/homebrew/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/urllib3/connectionpool.py", line 381, in _make_request
self._validate_conn(conn)
File "/opt/homebrew/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/urllib3/connectionpool.py", line 976, in _validate_conn
conn.connect()
File "/opt/homebrew/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/urllib3/connection.py", line 308, in connect
conn = self._new_conn()
File "/opt/homebrew/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/urllib3/connection.py", line 171, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/homebrew/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/awslogs/bin.py", line 179, in main
getattr(logs, options.func)()
File "/opt/homebrew/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/awslogs/core.py", line 229, in list_logs
consumer()
File "/opt/homebrew/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/awslogs/core.py", line 170, in consumer
for event in generator():
File "/opt/homebrew/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/awslogs/core.py", line 157, in generator
response = self.client.filter_log_events(**kwargs)
File "/opt/homebrew/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/botocore/client.py", line 316, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/opt/homebrew/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/botocore/client.py", line 621, in _make_api_call
http, parsed_response = self._make_request(
File "/opt/homebrew/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/botocore/client.py", line 641, in _make_request
return self._endpoint.make_request(operation_model, request_dict)
File "/opt/homebrew/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/botocore/endpoint.py", line 102, in make_request
return self._send_request(request_dict, operation_model)
File "/opt/homebrew/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/botocore/endpoint.py", line 136, in _send_request
while self._needs_retry(attempts, operation_model, request_dict,
File "/opt/homebrew/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/botocore/endpoint.py", line 253, in _needs_retry
responses = self._event_emitter.emit(
File "/opt/homebrew/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/botocore/hooks.py", line 356, in emit
return self._emitter.emit(aliased_event_name, **kwargs)
File "/opt/homebrew/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/botocore/hooks.py", line 228, in emit
return self._emit(event_name, kwargs)
File "/opt/homebrew/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/botocore/hooks.py", line 211, in _emit
response = handler(**kwargs)
File "/opt/homebrew/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/botocore/retryhandler.py", line 183, in __call__
if self._checker(attempts, response, caught_exception):
File "/opt/homebrew/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/botocore/retryhandler.py", line 250, in __call__
should_retry = self._should_retry(attempt_number, response,
File "/opt/homebrew/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/botocore/retryhandler.py", line 277, in _should_retry
return self._checker(attempt_number, response, caught_exception)
File "/opt/homebrew/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/botocore/retryhandler.py", line 316, in __call__
checker_response = checker(attempt_number, response,
File "/opt/homebrew/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/botocore/retryhandler.py", line 222, in __call__
return self._check_caught_exception(
File "/opt/homebrew/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/botocore/retryhandler.py", line 359, in _check_caught_exception
raise caught_exception
File "/opt/homebrew/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/botocore/endpoint.py", line 200, in _do_get_response
http_response = self._send(request)
File "/opt/homebrew/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/botocore/endpoint.py", line 269, in _send
return self.http_session.send(request)
File "/opt/homebrew/Cellar/awslogs/0.14.0_1/libexec/lib/python3.9/site-packages/botocore/httpsession.py", line 283, in send
raise EndpointConnectionError(endpoint_url=request.url, error=e)
botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint URL: "https://logs.us-east-1.amazonaws.com/"

Contributor guide

No contributing guide indexed for this repository

Research direction

The traceback points to awslogs/bin.py and awslogs/core.py, with the failure occurring while the CloudWatch client connects to https://logs.us-east-1.amazonaws.com/. Start by tracing how the endpoint is configured and used for the `awslogs get ... --watch` command, then reproduce the connection failure and verify the command can reach the configured AWS endpoint without the socket error.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python
Domain
cli, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.