Skip to content

Commit

Permalink
Add cluster wide Loggers endpoint (#10882)
Browse files Browse the repository at this point in the history
We currently only support changing entire subsystems on the entire cluster.

For debugging specific problems it might help to change the loglevel
of classes under a certain package name.
E.g.:

    http --auth admin:admin put :9000/api/cluster/system/loggers/org.graylog.plugins.events/level/DEBUG  X-Requested-By:httpie
  • Loading branch information
mpfz0r authored Jul 22, 2021
1 parent 4d67a94 commit d427537
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,16 @@ public void setSubsystemLoggerLevel(

remoteLoggersResource.setSubsystemLoggerLevel(subsystemTitle, level).execute();
}

@PUT
@Timed
@Path("/{loggerName}/level/{level}")
@ApiOperation(value = "Set the loglevel of a single logger",
notes = "Provided level is falling back to DEBUG if it does not exist")
@NoAuditEvent("proxy resource, audit event will be emitted on target nodes")
public Map<String, CallResult<Void>> setClusterSingleLoggerLevel(
@ApiParam(name = "loggerName", required = true) @PathParam("loggerName") @NotEmpty String loggerName,
@ApiParam(name = "level", required = true) @PathParam("level") @NotEmpty String level) throws NodeNotFoundException, IOException {
return requestOnAllNodes(createRemoteInterfaceProvider(RemoteLoggersResource.class), client -> client.setSingleLoggerLevel(loggerName, level));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public interface RemoteLoggersResource {
Call<Void> setSubsystemLoggerLevel(@Path("subsystem") String subsystemTitle, @Path("level") String level);

@PUT("system/loggers/{loggerName}/level/{level}")
Call<Void> setSingleLoggerLevel(String loggerName, String level);
Call<Void> setSingleLoggerLevel(@Path("loggerName") String loggerName, @Path("level") String level);

@GET("system/loggers/messages/recent")
Call<LogMessagesSummary> messages(int limit, String level);
Expand Down

0 comments on commit d427537

Please sign in to comment.