Skip to content

Commit

Permalink
Fixes influxdata#540 the log level API endpoint was not updated. (inf…
Browse files Browse the repository at this point in the history
…luxdata#559)

* fix log level endpoint
  • Loading branch information
Nathaniel Cook committed May 18, 2016
1 parent 29bbe80 commit 85ca539
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@
### Release Notes

### Features

- [#82](https://github.com/influxdata/kapacitor/issues/82): Multiple services for PagerDuty alert


### Bugfixes

- [#540](https://github.com/influxdata/kapacitor/issues/540): Fixes bug with log level API endpoint.

## v0.13.1 [2016-05-13]

### Release Notes
Expand Down
13 changes: 11 additions & 2 deletions services/httpd/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"github.com/influxdata/influxdb/models"
"github.com/influxdata/influxdb/services/meta"
"github.com/influxdata/influxdb/uuid"
"github.com/influxdata/kapacitor/client/v1"
"github.com/influxdata/wlog"
)

Expand Down Expand Up @@ -300,11 +301,19 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {

// serveLogLevel sets the log level of the server
func (h *Handler) serveLogLevel(w http.ResponseWriter, r *http.Request) {
l := r.URL.Query().Get("level")
err := wlog.SetLevelFromName(l)
var opt client.LogLevelOptions
dec := json.NewDecoder(r.Body)
err := dec.Decode(&opt)
if err != nil {
HttpError(w, "invalid json: "+err.Error(), true, http.StatusBadRequest)
return
}
err = wlog.SetLevelFromName(opt.Level)
if err != nil {
HttpError(w, err.Error(), true, http.StatusBadRequest)
return
}
w.WriteHeader(http.StatusNoContent)
}

// serveRoutes returns a list of all routs and their methods
Expand Down

0 comments on commit 85ca539

Please sign in to comment.