Api: add cache reset (#18941)

This commit is contained in:
andig 2025-02-24 22:50:30 +01:00 • committed by GitHub
parent 634bc4513d
commit d405ee4ba6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 0 deletions

View file

@ -301,6 +301,7 @@ func (s *HTTPd) RegisterSystemHandler(valueChan chan<- util.Param, cache *util.P
routes := map[string]route{
"log": {"GET", "/log", logHandler},
"logareas": {"GET", "/log/areas", logAreasHandler},
"reset": {"POST", "/reset", resetHandler},
"shutdown": {"POST", "/shutdown", func(w http.ResponseWriter, r *http.Request) {
shutdown()
w.WriteHeader(http.StatusNoContent)

View file

@ -292,6 +292,11 @@ func logAreasHandler(w http.ResponseWriter, r *http.Request) {
jsonResult(w, logstash.Areas())
}
func resetHandler(w http.ResponseWriter, r *http.Request) {
util.ResetCached()
jsonResult(w, "OK")
}
func logHandler(w http.ResponseWriter, r *http.Request) {
a := r.URL.Query()["area"]
l := logstash.LogLevelToThreshold(r.URL.Query().Get("level"))