Add X-Requested-By header to graylog input (#5011)
This commit is contained in:
parent
2d1f97c217
commit
ba612b670b
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue