diff pkg/controllers/routes.go @ 722:815f5e2ed974

Added simple endpoint to view system logs. api/system/log/{service}/{file} allows to retrieve the raw log file content for a selected set of services (currently "apache2" and "postgresql"). The result is a JSON with two fields: "path:" contains the fully qualified path of the retrieved log file in the servers file system and "content:" provides the verbatim content of the requested log file.
author Sascha Wilde <wilde@intevation.de>
date Fri, 21 Sep 2018 18:01:39 +0200
parents 3e9f0070c33e
children fdff2de616ad
line wrap: on
line diff
--- a/pkg/controllers/routes.go	Fri Sep 21 17:37:34 2018 +0200
+++ b/pkg/controllers/routes.go	Fri Sep 21 18:01:39 2018 +0200
@@ -43,6 +43,12 @@
 		Handle: deleteUser,
 	})).Methods(http.MethodDelete)
 
+	// System Management
+	api.Handle("/system/log/{service}/{file}", sysAdmin(&JSONHandler{
+		Handle: showSystemLog,
+		NoConn: true,
+	})).Methods(http.MethodGet)
+
 	// Password resets.
 	api.Handle("/users/passwordreset", &JSONHandler{
 		Input:  func() interface{} { return new(models.PWResetUser) },