initial commit - untested
This commit is contained in:
25
main.go
Normal file
25
main.go
Normal file
@@ -0,0 +1,25 @@
|
||||
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.")
|
||||
}
|
||||
Reference in New Issue
Block a user