@RestResource(path="/logs", title="Log files", description="Log files from this service", properties=@Property(name="HtmlSerializer.uriAnchorText.s",value="PROPERTY_NAME"), allowedMethodParams="*", pojoSwaps={IteratorSwap.class,DateSwap.ISO8601DT.class}) public class LogsResource extends BasicRestServlet
Modifier and Type | Class and Description |
---|---|
static class |
LogsResource.FileResource
File bean.
|
Constructor and Description |
---|
LogsResource() |
Modifier and Type | Method and Description |
---|---|
Object |
deleteFile(String path)
[DELETE /*] - Delete a file.
|
Object |
downloadFile(RestResponse res,
String path)
[DOWNLOAD /*] - Download file.
|
Object |
getFileOrDirectory(RestRequest req,
RestResponse res,
RequestProperties properties,
String path)
[GET /*] - Get file details or directory listing.
|
void |
init(RestContextBuilder builder)
Initializes the log directory and formatter.
|
void |
viewFile(RestRequest req,
RestResponse res,
String path,
RequestProperties properties,
boolean highlight,
String start,
String end,
String thread,
String[] loggers,
String[] severity)
[VIEW /*] - Retrieve the contents of a log file.
|
LogParser |
viewParsedEntries(RestRequest req,
String path,
String start,
String end,
String thread,
String[] loggers,
String[] severity)
[VIEW /*] - Retrieve the contents of a log file as parsed entries.
|
getOptions
destroy, getContext, getProperties, getServletConfig, init, log, log, log, log, logObjects, service
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
public LogsResource()
@RestHook(value=INIT) public void init(RestContextBuilder builder) throws Exception
builder
- The resource config.Exception
@RestMethod(name="GET", path="/*", swagger={"responses:{","200: {description:\'OK\'},","404: {description:\'Not Found\'}","}"}) public Object getFileOrDirectory(RestRequest req, RestResponse res, RequestProperties properties, @PathRemainder String path) throws Exception
req
- The HTTP requestres
- The HTTP responseproperties
- The writable properties for setting the descriptions.path
- The log file path.Exception
@RestMethod(name="VIEW", path="/*", swagger={"responses:{","200: {description:\'OK\'},","404: {description:\'Not Found\'}","}"}) public void viewFile(RestRequest req, RestResponse res, @PathRemainder String path, RequestProperties properties, @Query(value="highlight") boolean highlight, @Query(value="start") String start, @Query(value="end") String end, @Query(value="thread") String thread, @Query(value="loggers") String[] loggers, @Query(value="severity") String[] severity) throws Exception
req
- The HTTP request.res
- The HTTP response.path
- The log file path.properties
- The writable properties for setting the descriptions.highlight
- If true
, add color highlighting based on severity.start
- Optional start timestamp. Don't print lines logged before the specified timestamp. Example: "&start=2014-01-23 11:25:47".end
- Optional end timestamp. Don't print lines logged after the specified timestamp. Example: "&end=2014-01-23 11:25:47".thread
- Optional thread name filter. Only show log entries with the specified thread name. Example: "&thread=pool-33-thread-1".loggers
- Optional logger filter. Only show log entries if they were produced by one of the specified loggers (simple class name). Example: "&loggers=(LinkIndexService,LinkIndexRestService)".severity
- Optional severity filter. Only show log entries with the specified severity. Example: "&severity=(ERROR,WARN)".Exception
@RestMethod(name="PARSE", path="/*", converters=Queryable.class, swagger={"responses:{","200: {description:\'OK\'},","404: {description:\'Not Found\'}","}"}) public LogParser viewParsedEntries(RestRequest req, @PathRemainder String path, @Query(value="start") String start, @Query(value="end") String end, @Query(value="thread") String thread, @Query(value="loggers") String[] loggers, @Query(value="severity") String[] severity) throws Exception
req
- The HTTP request.path
- The log file path.start
- Optional start timestamp. Don't print lines logged before the specified timestamp. Example: "&start=2014-01-23 11:25:47".end
- Optional end timestamp. Don't print lines logged after the specified timestamp. Example: "&end=2014-01-23 11:25:47".thread
- Optional thread name filter. Only show log entries with the specified thread name. Example: "&thread=pool-33-thread-1".loggers
- Optional logger filter. Only show log entries if they were produced by one of the specified loggers (simple class name). Example: "&loggers=(LinkIndexService,LinkIndexRestService)".severity
- Optional severity filter. Only show log entries with the specified severity. Example: "&severity=(ERROR,WARN)".Exception
@RestMethod(name="DOWNLOAD", path="/*", swagger={"responses:{","200: {description:\'OK\'},","404: {description:\'Not Found\'}","}"}) public Object downloadFile(RestResponse res, @PathRemainder String path) throws Exception
res
- The HTTP response.path
- The log file path.Exception
@RestMethod(name="DELETE", path="/*", swagger={"responses:{","200: {description:\'OK\'},","404: {description:\'Not Found\'}","}"}) public Object deleteFile(@PathRemainder String path) throws Exception
path
- The log file path.Exception
Copyright © 2018 Apache. All rights reserved.