Skip to content

Commit

Permalink
fix: dynamic target for x509_cert
Browse files Browse the repository at this point in the history
  • Loading branch information
peter committed Jan 6, 2025
1 parent f458196 commit 472ce71
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions inputs/x509_cert/x509_cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ func (ins *Instance) Gather(slist *types.SampleList) {
return
}

if err := ins.sourcesToURLs(); err != nil {
log.Printf("E! failed to update sources: %v", err)
return
}

now := time.Now()
collectedUrls := append(ins.locations, ins.collectCertURLs()...)
for _, location := range collectedUrls {
Expand Down Expand Up @@ -273,6 +278,7 @@ func (ins *Instance) processCertificate(cert *x509.Certificate, opts x509.Verify
}

func (ins *Instance) sourcesToURLs() error {
ins.locations = []*url.URL{}
for _, target := range ins.Targets {
if strings.HasPrefix(target, "file://") || strings.HasPrefix(target, "/") {
target = filepath.ToSlash(strings.TrimPrefix(target, "file://"))
Expand Down

0 comments on commit 472ce71

Please sign in to comment.