Skip to content

Commit

Permalink
Merge pull request #216 from intelops/newcode
Browse files Browse the repository at this point in the history
removed unwanted logs
  • Loading branch information
vijeyash1 authored Sep 6, 2023
2 parents b4534a4 + 8c2dca8 commit 57d1f36
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions agent/kubviz/trivy.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ import (
func RunTrivyK8sClusterScan(js nats.JetStreamContext) error {
var report report.ConsolidatedReport
out, err := executeCommand("trivy k8s --report summary cluster --timeout 60m -f json -q --cache-dir /tmp/.cache")
log.Println("Commnd for k8s cluster scan: trivy k8s --report summary cluster --timeout 60m -f json -q --cache-dir /tmp/.cache")
// log.Println("Commnd for k8s cluster scan: trivy k8s --report summary cluster --timeout 60m -f json -q --cache-dir /tmp/.cache")
parts := strings.SplitN(out, "{", 2)
if len(parts) <= 1 {
log.Println("No output from k8s cluster scan command", err)
return err
}
log.Println("Command logs for k8s cluster scan", parts[0])
// log.Println("Command logs for k8s cluster scan", parts[0])
jsonPart := "{" + parts[1]
// log.Println("First 200 k8s cluster scan lines output", jsonPart[:200])
// log.Println("Last 200 k8s cluster scan lines output", jsonPart[len(jsonPart)-200:])
Expand Down
6 changes: 3 additions & 3 deletions agent/kubviz/trivy_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ func RunTrivyImageScans(config *rest.Config, js nats.JetStreamContext) error {
continue // Move on to the next image if there's no output
}

log.Println("Command logs for image", parts[0])
// log.Println("Command logs for image", parts[0])
jsonPart := "{" + parts[1]
log.Println("First 200 image scan lines output", jsonPart[:200])
log.Println("Last 200 image scan lines output", jsonPart[len(jsonPart)-200:])
// log.Println("First 200 image scan lines output", jsonPart[:200])
// log.Println("Last 200 image scan lines output", jsonPart[len(jsonPart)-200:])

err = json.Unmarshal([]byte(jsonPart), &report)
if err != nil {
Expand Down
3 changes: 1 addition & 2 deletions agent/kubviz/trivy_sbom.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ func RunTrivySbomScan(config *rest.Config, js nats.JetStreamContext) error {
log.Printf("failed to list images: %v", err)
}
for _, image := range images {
fmt.Printf("pullable Image %#v\n", image.PullableImage)

command := fmt.Sprintf("trivy image --format cyclonedx %s %s", image.PullableImage, "--cache-dir /tmp/.cache")
out, err := executeCommandSbom(command)
Expand All @@ -74,7 +73,7 @@ func RunTrivySbomScan(config *rest.Config, js nats.JetStreamContext) error {
log.Printf("Error unmarshaling JSON data for image sbom %s: %v", image.PullableImage, err)
continue // Move on to the next image in case of an error
}
log.Println("report", report)
// log.Println("report", report)

// Publish the report using the given function
publishTrivySbomReport(report, js)
Expand Down

0 comments on commit 57d1f36

Please sign in to comment.