Skip to content

Commit c18c085

Browse files
committed
added source config for splunk reporting
1 parent 4310c0b commit c18c085

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

examples/splunksettings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
"url":"https://example.com/hec/services/collector/event",
3-
"authkey":"Splunk xyz"
3+
"authkey":"Splunk xyz",
4+
"source": "rtapi for splunk by PeaStew"
45
}

rtapi.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ type endpointQuery struct {
4949
type splunkSettings struct {
5050
Url string `json:"url" yaml:"url"`
5151
Authkey string `json:"authkey" yaml:"authkey"`
52+
Source string `json:"source" yaml:"source"`
5253
}
5354

5455
type splunkEvent struct {
@@ -366,10 +367,11 @@ func sendJsonToSplunk(endpoints []endpointDetails, splunkSettings splunkSettings
366367
if err != nil {
367368
panic(err)
368369
}
369-
var splunkMessage = splunkEvent{now.Unix(), name, "rtapi by PeaStew", endpoints[i]}
370370

371+
var splunkMessage = splunkEvent{now.Unix(), name, splunkSettings.Source, endpoints[i]}
371372
jsonInfo, _ := json.Marshal(splunkMessage)
372373
var jsonStr = []byte(jsonInfo)
374+
373375
//log.Print(splunkSettings.Url)
374376
//log.Print(splunkSettings.Authkey)
375377

0 commit comments

Comments
 (0)