diff --git a/api/app-admin-routes.go b/api/app-admin-routes.go index 34054e9..323c015 100644 --- a/api/app-admin-routes.go +++ b/api/app-admin-routes.go @@ -174,7 +174,10 @@ func (api *API) appGetAdminLogs(c *gin.Context) { rAdminLogs.Filter = strings.TrimSpace(rAdminLogs.Filter) var jqFilter *gojq.Code - if rAdminLogs.Filter != "" { + var basicFilter string + if strings.HasPrefix(rAdminLogs.Filter, "\"") && strings.HasSuffix(rAdminLogs.Filter, "\"") { + basicFilter = rAdminLogs.Filter[1 : len(rAdminLogs.Filter)-1] + } else if rAdminLogs.Filter != "" { parsed, err := gojq.Parse(rAdminLogs.Filter) if err != nil { log.Error("Unable to parse JQ filter") @@ -220,12 +223,17 @@ func (api *API) appGetAdminLogs(c *gin.Context) { continue } - // No Filter - if jqFilter == nil { + // Basic Filter + if basicFilter != "" && strings.Contains(string(rawData), basicFilter) { logLines = append(logLines, string(rawData)) continue } + // No JQ Filter + if jqFilter == nil { + continue + } + // Error or nil result, _ := jqFilter.Run(jsonMap).Next() if _, ok := result.(error); ok {