The splunk handler sends events from sawmill to the Splunk logging service. It works with both Splunk Enterprise and Splunk Cloud.
Example Usage:
package main
import (
"os"
"github.com/phemmer/sawmill"
"github.com/phemmer/sawmill/handler/splunk"
)
func main() {
defer sawmill.Stop()
splunkURL := "https://username:[email protected]:8089/?index=development"
if s, err := splunk.New(splunkURL); err != nil {
sawmill.Fatal("could not setup splunk handler", sawmill.Fields{"error": err})
} else {
sawmill.AddHandler("splunk", s)
}
path := "/test"
_, err := os.Create(path)
if err != nil {
sawmill.Error("Failed to create file", sawmill.Fields{"error": err, "path": path})
}
}