Add X-Requested-By header to graylog input (#5011)

This commit is contained in:
gurayyildirim 2018-11-29 03:52:03 +03:00 committed by Daniel Nelson
parent 2d1f97c217
commit ba612b670b
1 changed files with 3 additions and 0 deletions

View File

@ -235,6 +235,9 @@ func (h *GrayLog) sendRequest(serverURL string) (string, float64, error) {
if err != nil { if err != nil {
return "", -1, fmt.Errorf("Invalid server URL \"%s\"", serverURL) return "", -1, fmt.Errorf("Invalid server URL \"%s\"", serverURL)
} }
// Add X-Requested-By header
headers["X-Requested-By"] = requestURL.Hostname()
if strings.Contains(requestURL.String(), "multiple") { if strings.Contains(requestURL.String(), "multiple") {
m := &Messagebody{Metrics: h.Metrics} m := &Messagebody{Metrics: h.Metrics}
http_body, err := json.Marshal(m) http_body, err := json.Marshal(m)