@RestResource(path="/logs",title="Log files",description="Log files from this service",properties={@Property(name="HtmlSerializer.uriAnchorText.s",value="PROPERTY_NAME"),@Property(name="LogsResource.logDir.s",value="$C{Logging/logDir}"),@Property(name="LogsResource.allowDeletes.b",value="$C{Logging/allowDeletes,true}"),@Property(name="LogsResource.logFormat.s",value="$C{Logging/format}"),@Property(name="LogsResource.dateFormat.s",value="$C{Logging/dateFormat}"),@Property(name="LogsResource.useStackTraceHashes.b",value="$C{Logging/useStackTraceHashes}")},allowedMethodParams="*",pojoSwaps={IteratorSwap.class,DateSwap.ISO8601DT.class}) public class LogsResource extends BasicRestServlet
Modifier and Type | Class and Description |
---|---|
static class |
LogsResource.Action |
static class |
LogsResource.FileResource |
Modifier and Type | Field and Description |
---|---|
static String |
LOGS_RESOURCE_allowDeletes
Configuration property: Allow deletes on files.
|
static String |
LOGS_RESOURCE_dateFormat
Configuration property: Log entry format.
|
static String |
LOGS_RESOURCE_logDir
Configuration property: Root directory.
|
static String |
LOGS_RESOURCE_logFormat
Configuration property: Log entry format.
|
static String |
LOGS_RESOURCE_useStackTraceHashes
Configuration property: Log entry format.
|
Constructor and Description |
---|
LogsResource() |
Modifier and Type | Method and Description |
---|---|
org.apache.juneau.microservice.resources.LogsResource.RedirectToRoot |
deleteFile(String path) |
org.apache.juneau.microservice.resources.LogsResource.FileContents |
downloadFile(RestResponse res,
String path) |
LogsResource.FileResource |
getFile(RestRequest req,
String path) |
void |
init(RestContextBuilder b) |
void |
viewFile(RestResponse res,
String path,
boolean highlight,
String start,
String end,
String thread,
String[] loggers,
String[] severity) |
LogParser |
viewParsedEntries(RestRequest req,
String path,
String start,
String end,
String thread,
String[] loggers,
String[] severity) |
getOptions
destroy, getContext, getProperties, getRequest, getResponse, getServletConfig, init, log, log, log, log, logObjects, service, setContext
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
public static final String LOGS_RESOURCE_logDir
public static final String LOGS_RESOURCE_allowDeletes
public static final String LOGS_RESOURCE_logFormat
public static final String LOGS_RESOURCE_dateFormat
public static final String LOGS_RESOURCE_useStackTraceHashes
public LogsResource()
@RestHook(value=INIT) public void init(RestContextBuilder b) throws Exception
Exception
@RestMethod(name="GET", path="/*", summary="View information on file or directory", description="Returns information about the specified file or directory.", htmldoc=) public LogsResource.FileResource getFile(RestRequest req, @Path(value="/*") String path) throws NotFound, Exception
@RestMethod(name="VIEW", path="/*", summary="View contents of log file", description="View the contents of a log file.") public void viewFile(RestResponse res, @Path(value="/*") String path, @Query(name="highlight",description="Add severity color highlighting.",example="true") boolean highlight, @Query(name="start",description="Start timestamp (ISO8601, full or partial).\nDon\'t print lines logged before the specified timestamp.\nUse any of the following formats: yyyy, yyyy-MM, yyyy-MM-dd, yyyy-MM-ddThh, yyyy-MM-ddThh:mm, yyyy-MM-ddThh:mm:ss, yyyy-MM-ddThh:mm:ss.SSS",example="2014-01-23T11:25:47") String start, @Query(name="end",description="End timestamp (ISO8601, full or partial).\nDon\'t print lines logged after the specified timestamp.\nUse any of the following formats: yyyy, yyyy-MM, yyyy-MM-dd, yyyy-MM-ddThh, yyyy-MM-ddThh:mm, yyyy-MM-ddThh:mm:ss, yyyy-MM-ddThh:mm:ss.SSS",example="2014-01-24") String end, @Query(name="thread",description="Thread name filter.\nOnly show log entries with the specified thread name.",example="thread-pool-33-thread-1") String thread, @Query(name="loggers",description="Logger filter (simple class name).\nOnly show log entries if they were produced by one of the specified loggers.",example="[\'LinkIndexService\',\'LinkIndexRestService\']") String[] loggers, @Query(name="severity",description="Severity filter.\nOnly show log entries with the specified severity.",example="[\'ERROR\',\'WARN\']") String[] severity) throws NotFound, MethodNotAllowed, IOException
NotFound
MethodNotAllowed
IOException
@RestMethod(name="PARSE", path="/*", converters=Queryable.class, summary="View parsed contents of file", description="View the parsed contents of a file.", htmldoc=, swagger=) public LogParser viewParsedEntries(RestRequest req, @Path(value="/*") String path, @Query(name="start",description="Start timestamp (ISO8601, full or partial).\nDon\'t print lines logged before the specified timestamp.\nUse any of the following formats: yyyy, yyyy-MM, yyyy-MM-dd, yyyy-MM-ddThh, yyyy-MM-ddThh:mm, yyyy-MM-ddThh:mm:ss, yyyy-MM-ddThh:mm:ss.SSS",example="2014-01-23T11:25:47") String start, @Query(name="end",description="End timestamp (ISO8601, full or partial).\nDon\'t print lines logged after the specified timestamp.\nUse any of the following formats: yyyy, yyyy-MM, yyyy-MM-dd, yyyy-MM-ddThh, yyyy-MM-ddThh:mm, yyyy-MM-ddThh:mm:ss, yyyy-MM-ddThh:mm:ss.SSS",example="2014-01-24") String end, @Query(name="thread",description="Thread name filter.\nOnly show log entries with the specified thread name.",example="thread-pool-33-thread-1") String thread, @Query(name="loggers",description="Logger filter (simple class name).\nOnly show log entries if they were produced by one of the specified loggers.",example="[\'LinkIndexService\',\'LinkIndexRestService\']") String[] loggers, @Query(name="severity",description="Severity filter.\nOnly show log entries with the specified severity.",example="[\'ERROR\',\'WARN\']") String[] severity) throws NotFound, IOException
NotFound
IOException
@RestMethod(name="DOWNLOAD", path="/*", summary="Download file", description="Download the contents of a file.\nContent-Type is set to \'application/octet-stream\'.") public org.apache.juneau.microservice.resources.LogsResource.FileContents downloadFile(RestResponse res, @Path(value="/*") String path) throws NotFound, MethodNotAllowed
NotFound
MethodNotAllowed
@RestMethod(name="DELETE", path="/*", summary="Delete log file", description="Delete a log file on the file system.") public org.apache.juneau.microservice.resources.LogsResource.RedirectToRoot deleteFile(@Path(value="/*") String path) throws MethodNotAllowed
MethodNotAllowed
Copyright © 2018 Apache. All rights reserved.