Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error logs should be logged as error level in the log-processor function #305

Closed
James96315 opened this issue Aug 20, 2024 · 0 comments · Fixed by #306
Closed

Error logs should be logged as error level in the log-processor function #305

James96315 opened this issue Aug 20, 2024 · 0 comments · Fixed by #306
Labels
enhancement New feature or request

Comments

@James96315
Copy link
Contributor

Describe the feature

The log-processor function has to change the log level to Info in order for the permission issue to connect to OpenSearch to show up in CloudWatch Logs. Errors should be logged at the Error level.

Use Case

The log level for lines 94 and 110 should be logged as error.

if response.status_code == 403 or response.status_code == 409:
logger.info(
"Please add access to OpenSearch for this Lambda and rerun this"
)
if response.status_code == 403:
self.map_backend_role()
raise APIException(
ErrorCode.UNKNOWN_ERROR,
"Lambda does not have permission to call AOS, the message will be re-consumed and then retried. ",
)
if retry >= total_retry:
logger.info(
"%s failed after %d retries, please manually create it",
func_name,
retry,
)
logger.info(
"the last response code is %d, the last response content is %s",
response.status_code,
response.content,
)
raise APIException(
ErrorCode.UNKNOWN_ERROR,
f"Lambda has called AOS {total_retry} times, the message will be re-consumed and then retried. ",
)

Proposed Solution

No response

Other Information

No response

Solution version used

v2.2.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

Successfully merging a pull request may close this issue.

1 participant