Browse Source

Improved HTTP logging

tags/v0.1.0
Russ Garrett 7 years ago
parent
commit
af8ec06dc6
No account linked to committer's email address
2 changed files with 3 additions and 1 deletions
  1. 1
    1
      httplistener/generic.go
  2. 2
    0
      httplistener/grafana.go

+ 1
- 1
httplistener/generic.go View File

@@ -22,7 +22,7 @@ func (hl *HTTPListener) genericHandler(w http.ResponseWriter, request *http.Requ
22 22
 	buf.ReadFrom(request.Body)
23 23
 	json.Unmarshal(buf.Bytes(), &message)
24 24
 
25
-	log.Infof("[%s] %s", message.To, message.Body)
25
+	log.Infof("%s [%s] %s", request.RemoteAddr, message.To, message.Body)
26 26
 
27 27
 	if message.To != "" && message.Body != "" {
28 28
 		hl.irc.Privmsgf(message.To, message.Body)

+ 2
- 0
httplistener/grafana.go View File

@@ -38,5 +38,7 @@ func (hl *HTTPListener) grafanaAlertHandler(w http.ResponseWriter, request *http
38 38
 		msg += fmt.Sprintf(" %s:%f", match.Metric, match.Value)
39 39
 	}
40 40
 	msg += " " + alert.RuleUrl
41
+
42
+	log.Infof("%s [%s] Grafana alert", request.RemoteAddr, viper.GetString("http.listeners.grafana"))
41 43
 	hl.irc.Privmsgf(viper.GetString("http.listeners.grafana"), msg)
42 44
 }

Loading…
Cancel
Save