26 lines
583 B
Go
26 lines
583 B
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
"os/exec"
|
|
)
|
|
|
|
func main() {
|
|
// Initialize LokiLogger
|
|
lokiLogger := NewLokiLogger("http://localhost:3100/loki/api/v1/push") // Replace with your Loki URL
|
|
|
|
// Run the Argo command
|
|
cmd := exec.Command("argo", "submit", "your-workflow.yaml")
|
|
output, err := cmd.CombinedOutput()
|
|
if err != nil {
|
|
log.Fatalf("failed to run Argo command: %v", err)
|
|
}
|
|
|
|
// Send logs to Loki
|
|
if err := lokiLogger.Log(`{job="argo"}`, string(output)); err != nil {
|
|
log.Fatalf("failed to send logs to Loki: %v", err)
|
|
}
|
|
|
|
log.Println("Logs sent to Loki successfully.")
|
|
}
|