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

PMM-12631 removed alertmanager configs from logs. #2584

Merged
merged 4 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions api-tests/server/logs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,8 @@ func TestDownloadLogs(t *testing.T) {
assert.NoError(t, err)

expected := []string{
"alertmanager.base.yml",
"alertmanager.ini",
"alertmanager.log",
"alertmanager.yml",
"clickhouse-server.log",
"client/list.txt",
"client/pmm-admin-version.txt",
Expand Down
2 changes: 1 addition & 1 deletion docs/api/pmm-server-config/troubleshooting/logs.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The structure of the logs is as follows:
{
"codes": [
{
"code": "# tree\n├── alertmanager.base.yml\n├── alertmanager.ini\n├── alertmanager.log\n├── alertmanager.yml\n├── clickhouse-server.err.log\n├── clickhouse-server.log\n├── clickhouse-server.startup.log\n├── client\n│ ├── list.txt\n│ ├── pmm-admin-version.txt\n│ ├── pmm-agent-config.yaml\n│ ├── pmm-agent-version.txt\n│ └── status.json\n├── cron.log\n├── dashboard-upgrade.log\n├── dbaas-controller.log\n├── grafana.log\n├── installed.json\n├── nginx.conf\n├── nginx.log\n├── nginx.startup.log\n├── pmm-agent.log\n├── pmm-agent.yaml\n├── pmm-managed.log\n├── pmm-ssl.conf\n├── pmm-update-perform-init.log\n├── pmm-update-perform.log\n├── pmm-version.txt\n├── pmm.conf\n├── pmm.ini\n├── postgresql.log\n├── postgresql.startup.log\n├── prometheus.base.yml\n├── prometheus.log\n├── qan-api2.ini\n├── qan-api2.log\n├── supervisorctl_status.log\n├── supervisord.conf\n├── supervisord.log\n├── systemctl_status.log\n├── victoriametrics-promscrape.yml\n├── victoriametrics.ini\n├── victoriametrics.log\n├── victoriametrics_targets.json\n├── vmalert.ini\n└── vmalert.log",
"code": "# tree\n├── alertmanager.ini\n├── alertmanager.log\n├── clickhouse-server.err.log\n├── clickhouse-server.log\n├── clickhouse-server.startup.log\n├── client\n│ ├── list.txt\n│ ├── pmm-admin-version.txt\n│ ├── pmm-agent-config.yaml\n│ ├── pmm-agent-version.txt\n│ └── status.json\n├── cron.log\n├── dashboard-upgrade.log\n├── dbaas-controller.log\n├── grafana.log\n├── installed.json\n├── nginx.conf\n├── nginx.log\n├── nginx.startup.log\n├── pmm-agent.log\n├── pmm-agent.yaml\n├── pmm-managed.log\n├── pmm-ssl.conf\n├── pmm-update-perform-init.log\n├── pmm-update-perform.log\n├── pmm-version.txt\n├── pmm.conf\n├── pmm.ini\n├── postgresql.log\n├── postgresql.startup.log\n├── prometheus.base.yml\n├── prometheus.log\n├── qan-api2.ini\n├── qan-api2.log\n├── supervisorctl_status.log\n├── supervisord.conf\n├── supervisord.log\n├── systemctl_status.log\n├── victoriametrics-promscrape.yml\n├── victoriametrics.ini\n├── victoriametrics.log\n├── victoriametrics_targets.json\n├── vmalert.ini\n└── vmalert.log",
"language": "text"
}
]
Expand Down
4 changes: 2 additions & 2 deletions managed/services/checks/checks.go
Original file line number Diff line number Diff line change
Expand Up @@ -1490,7 +1490,7 @@ func (s *Service) filterSupportedChecks(advisors []check.Advisor) []check.Adviso
for _, advisor := range advisors {
checks := make([]check.Check, 0, len(advisor.Checks))

loop:
LOOP:
for _, c := range advisor.Checks {
if c.Version > maxSupportedVersion {
s.l.Warnf("Unsupported checks version: %d, max supported version: %d.", c.Version, maxSupportedVersion)
Expand All @@ -1507,7 +1507,7 @@ func (s *Service) filterSupportedChecks(advisors []check.Advisor) []check.Adviso
for _, query := range c.Queries {
if ok := isQueryTypeSupported(query.Type); !ok {
s.l.Warnf("Unsupported query type: %s.", query.Type)
continue loop
continue LOOP
}
}
}
Expand Down
32 changes: 0 additions & 32 deletions managed/services/supervisord/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@ import (
"sync"
"time"

"github.com/percona/promconfig/alertmanager"
"github.com/pkg/errors"
"golang.org/x/sys/unix"
"gopkg.in/yaml.v3"

pprofUtils "github.com/percona/pmm/managed/utils/pprof"
"github.com/percona/pmm/utils/logger"
Expand Down Expand Up @@ -149,23 +147,6 @@ func (l *Logs) files(ctx context.Context, pprofConfig *PprofConfig) []fileConten
Err: err,
})
}
for _, f := range []string{
"/etc/alertmanager.yml",
"/srv/alertmanager/alertmanager.base.yml",
} {
b, m, err := readFile(f)
if err == nil {
b, err = maskAlertManagerSensitiveValues(b)
files = append(files, fileContent{
Name: filepath.Base(f),
Modified: m,
Data: b,
Err: err,
})
} else {
logger.Get(ctx).WithField("component", "logs").Error(err)
}
}
// add configs
for _, f := range []string{
"/etc/nginx/nginx.conf",
Expand Down Expand Up @@ -443,16 +424,3 @@ func addAdminSummary(ctx context.Context, zw *zip.Writer) error {

return nil
}

func maskAlertManagerSensitiveValues(data []byte) ([]byte, error) {
var c alertmanager.Config
err := yaml.Unmarshal(data, &c)
if err != nil {
return data, err
}
nc, err := c.Mask()
if err != nil {
return data, err
}
return yaml.Marshal(nc)
}
2 changes: 0 additions & 2 deletions managed/services/supervisord/logs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@ import (
)

var commonExpectedFiles = []string{
"alertmanager.base.yml",
"alertmanager.ini",
"alertmanager.log",
"alertmanager.yml",
"clickhouse-server.log",
"grafana.log",
"installed.json",
Expand Down
Loading