Skip to content
This repository has been archived by the owner on Aug 12, 2019. It is now read-only.

Latest commit

 

History

History
33 lines (25 loc) · 934 Bytes

README.md

File metadata and controls

33 lines (25 loc) · 934 Bytes

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})
	}
}

Screenshot