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

Added HEC error messages #36871

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sbylica-splunk
Copy link

Description

Errors returned from Splunk HEC will be displayed in logs. This will help discover some issues without extensive debugging.

Testing

Unit testing and manual testing of the feature

@sbylica-splunk
Copy link
Author

Had to close the previous PR because of messy commit history, so reopening here.

#35712

// Check if there is any error text returned by Splunk that we can append to the error message
if resp.ContentLength > 0 {
var jsonResponse map[string]any
bodyString, _ := io.ReadAll(resp.Body)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
bodyString, _ := io.ReadAll(resp.Body)
body, _ := io.ReadAll(resp.Body)

https://pkg.go.dev/io#ReadAll returns a byte array, bodyString is misleading, this is not a string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants