[STORY-2042] log-drains: Add OpenSearch support #1110
[STORY-2042] log-drains: Add OpenSearch support #1110
Conversation
cmd/log_drains.go
Outdated
| "scalingo --app my-app log-drains-add --type syslog --host custom.logstash.com --port 12345", | ||
| "scalingo --app my-app log-drains-add --type syslog --token 123456789abcdef --host custom.logstash.com --port 12345", | ||
| "scalingo --app my-app log-drains-add --type elk --url https://my-user:123456789abcdef@logstash-app-name.osc-fr1.scalingo.io", | ||
| "scalingo --app my-app log-drains-add --type opensearch --url https://my-user:123456789abcdef@my-app-name.opensearch.osc-fr1.scalingo-dbs.com:30123/yourindex/_doc?pipeline=your_pipeline", |
There was a problem hiding this comment.
Hardcoded sensitive data leaked
Semgrep has detected a leak of sensitive data in this code. This secret data could be used by internal or external malicious actors. We highly recommend you change, reset, or rotate the sensitive data.
A secret is hard-coded in the application. Secrets stored in source code, such as credentials, identifiers, and other types of sensitive data, can be leaked and used by internal or external malicious actors. It is recommended to rotate the secret and retrieve them from a secure secret vault or Hardware Security Module (HSM), alternatively environment variables can be used if allowed by your company policy.
🚀 Fixed in commit e028585 🚀
There was a problem hiding this comment.
/fp its a url example
curzolapierre
left a comment
There was a problem hiding this comment.
I've some comments, but overall LGTM 👍
cmd/log_drains.go
Outdated
| "scalingo --app my-app log-drains-add --type syslog --host custom.logstash.com --port 12345", | ||
| "scalingo --app my-app log-drains-add --type syslog --token 123456789abcdef --host custom.logstash.com --port 12345", | ||
| "scalingo --app my-app log-drains-add --type elk --url https://my-user:123456789abcdef@logstash-app-name.osc-fr1.scalingo.io", | ||
| "scalingo --app my-app log-drains-add --type opensearch --url https://my-user:123456789abcdef@my-app-name.opensearch.osc-fr1.scalingo-dbs.com:30123/yourindex/_doc?pipeline=your_pipeline", |
There was a problem hiding this comment.
Nitpick: as we are mentionning my-app I also expect to have my_pipeline and myindex, WDYT?
| "scalingo --app my-app log-drains-add --type syslog --host custom.logstash.com --port 12345", | ||
| "scalingo --app my-app log-drains-add --type syslog --token 123456789abcdef --host custom.logstash.com --port 12345", | ||
| "scalingo --app my-app log-drains-add --type elk --url https://my-user:123456789abcdef@logstash-app-name.osc-fr1.scalingo.io", | ||
| "scalingo --app my-app log-drains-add --type opensearch --url https://my-user:123456789abcdef@my-app-name.opensearch.osc-fr1.scalingo-dbs.com:30123/myindex/_doc?pipeline=my_pipeline", |
There was a problem hiding this comment.
Hardcoded sensitive data leaked
Semgrep has detected a leak of sensitive data in this code. This secret data could be used by internal or external malicious actors. We highly recommend you change, reset, or rotate the sensitive data.
A secret is hard-coded in the application. Secrets stored in source code, such as credentials, identifiers, and other types of sensitive data, can be leaked and used by internal or external malicious actors. It is recommended to rotate the secret and retrieve them from a secure secret vault or Hardware Security Module (HSM), alternatively environment variables can be used if allowed by your company policy.
💬 To ignore this, reply with:
• /fp <comment> for false positive
• /ar <comment> for acceptable risk
• /other <comment> for all other reasons
Alternatively, triage in Semgrep AppSec Platform to ignore the finding created by generic_uri_string.
| // Check if this is a "not found" error, which can happen if the log drain | ||
| // was already removed by the main API call | ||
| if strings.Contains(err.Error(), "not found") { | ||
| io.Status("Log drain", opts.URL, "was already removed from the addon", addon.AddonProvider.Name) |
There was a problem hiding this comment.
Questions: (Sorry for the late notice) is this message will be logged when an addon never got the log drains?
If yes, the message is not totally accurate, WDYT?
This PR introduces OpenSearch support for log drains and improves error handling throughout the log drains functionality.
Changes: