Skip to content
Snippets Groups Projects
Commit 40550e76 authored by ale's avatar ale
Browse files

Log unmatched requests

parent 3918f642
No related branches found
No related tags found
No related merge requests found
......@@ -57,6 +57,7 @@ func (c *Collector) ServeHTTP(w http.ResponseWriter, req *http.Request) {
// Find a handler that can successfully parse the request, and
// get a list of Events.
var events []Event
matched := false
hloop:
for _, h := range c.handlers {
var err error
......@@ -65,15 +66,22 @@ hloop:
case ErrNoMatch:
continue
case nil:
matched = true
w.WriteHeader(http.StatusOK)
break hloop
default:
log.Printf("error parsing report: %v", err)
log.Printf("error parsing report (%s): %v", ct, err)
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
}
if !matched {
log.Printf("no matching handlers for \"%s\"", ct)
http.Error(w, "No matching handlers", http.StatusBadRequest)
return
}
// Augment the Events with additional information obtained
// from the HTTP request, and send them to the forwarder.
for _, e := range events {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment