use of io.cdap.cdap.common.logging.LoggingContext in project cdap by caskdata.
the class LogHttpHandler method getLogs.
@GET
@Path("/namespaces/{namespace-id}/apps/{app-id}/{program-type}/{program-id}/logs")
public void getLogs(HttpRequest request, HttpResponder responder, @PathParam("namespace-id") String namespaceId, @PathParam("app-id") String appId, @PathParam("program-type") String programType, @PathParam("program-id") String programId, @QueryParam("start") @DefaultValue("-1") long fromTimeSecsParam, @QueryParam("stop") @DefaultValue("-1") long toTimeSecsParam, @QueryParam("escape") @DefaultValue("true") boolean escape, @QueryParam("filter") @DefaultValue("") String filterStr, @QueryParam("format") @DefaultValue("text") String format, @QueryParam("suppress") List<String> suppress) throws Exception {
ensureVisibilityOnProgram(namespaceId, appId, programType, programId);
LoggingContext loggingContext = LoggingContextHelper.getLoggingContext(namespaceId, appId, programId, ProgramType.valueOfCategoryName(programType));
doGetLogs(logReader, responder, loggingContext, fromTimeSecsParam, toTimeSecsParam, escape, filterStr, null, format, suppress);
}
use of io.cdap.cdap.common.logging.LoggingContext in project cdap by caskdata.
the class LogHttpHandler method runIdNext.
@GET
@Path("/namespaces/{namespace-id}/apps/{app-id}/{program-type}/{program-id}/runs/{run-id}/logs/next")
public void runIdNext(HttpRequest request, HttpResponder responder, @PathParam("namespace-id") String namespaceId, @PathParam("app-id") String appId, @PathParam("program-type") String programType, @PathParam("program-id") String programId, @PathParam("run-id") String runId, @QueryParam("max") @DefaultValue("50") int maxEvents, @QueryParam("fromOffset") @DefaultValue("") String fromOffsetStr, @QueryParam("escape") @DefaultValue("true") boolean escape, @QueryParam("filter") @DefaultValue("") String filterStr, @QueryParam("format") @DefaultValue("text") String format, @QueryParam("suppress") List<String> suppress) throws Exception {
ensureVisibilityOnProgram(namespaceId, appId, programType, programId);
ProgramType type = ProgramType.valueOfCategoryName(programType);
ProgramRunId programRunId = new ProgramRunId(namespaceId, appId, type, programId, runId);
RunRecordDetail runRecord = getRunRecordMeta(programRunId);
LoggingContext loggingContext = LoggingContextHelper.getLoggingContextWithRunId(programRunId, runRecord.getSystemArgs());
doNext(logReader, responder, loggingContext, maxEvents, fromOffsetStr, escape, filterStr, runRecord, format, suppress);
}
use of io.cdap.cdap.common.logging.LoggingContext in project cdap by caskdata.
the class LogHttpHandler method sysNext.
@GET
@Path("/system/{component-id}/{service-id}/logs/next")
public void sysNext(HttpRequest request, HttpResponder responder, @PathParam("component-id") String componentId, @PathParam("service-id") String serviceId, @QueryParam("max") @DefaultValue("50") int maxEvents, @QueryParam("fromOffset") @DefaultValue("") String fromOffsetStr, @QueryParam("escape") @DefaultValue("true") boolean escape, @QueryParam("filter") @DefaultValue("") String filterStr, @QueryParam("format") @DefaultValue("text") String format, @QueryParam("suppress") List<String> suppress) throws Exception {
accessEnforcer.enforce(NamespaceId.SYSTEM, authenticationContext.getPrincipal(), StandardPermission.GET);
LoggingContext loggingContext = LoggingContextHelper.getLoggingContext(Id.Namespace.SYSTEM.getId(), componentId, serviceId);
doNext(logReader, responder, loggingContext, maxEvents, fromOffsetStr, escape, filterStr, null, format, suppress);
}
use of io.cdap.cdap.common.logging.LoggingContext in project cdap by caskdata.
the class LogHttpHandler method sysPrev.
@GET
@Path("/system/{component-id}/{service-id}/logs/prev")
public void sysPrev(HttpRequest request, HttpResponder responder, @PathParam("component-id") String componentId, @PathParam("service-id") String serviceId, @QueryParam("max") @DefaultValue("50") int maxEvents, @QueryParam("fromOffset") @DefaultValue("") String fromOffsetStr, @QueryParam("escape") @DefaultValue("true") boolean escape, @QueryParam("filter") @DefaultValue("") String filterStr, @QueryParam("format") @DefaultValue("text") String format, @QueryParam("suppress") List<String> suppress) throws Exception {
accessEnforcer.enforce(NamespaceId.SYSTEM, authenticationContext.getPrincipal(), StandardPermission.GET);
LoggingContext loggingContext = LoggingContextHelper.getLoggingContext(Id.Namespace.SYSTEM.getId(), componentId, serviceId);
doPrev(logReader, responder, loggingContext, maxEvents, fromOffsetStr, escape, filterStr, null, format, suppress);
}
use of io.cdap.cdap.common.logging.LoggingContext in project cdap by caskdata.
the class LogHttpHandler method next.
@GET
@Path("/namespaces/{namespace-id}/apps/{app-id}/{program-type}/{program-id}/logs/next")
public void next(HttpRequest request, HttpResponder responder, @PathParam("namespace-id") String namespaceId, @PathParam("app-id") String appId, @PathParam("program-type") String programType, @PathParam("program-id") String programId, @QueryParam("max") @DefaultValue("50") int maxEvents, @QueryParam("fromOffset") @DefaultValue("") String fromOffsetStr, @QueryParam("escape") @DefaultValue("true") boolean escape, @QueryParam("filter") @DefaultValue("") String filterStr, @QueryParam("format") @DefaultValue("text") String format, @QueryParam("suppress") List<String> suppress) throws Exception {
ensureVisibilityOnProgram(namespaceId, appId, programType, programId);
LoggingContext loggingContext = LoggingContextHelper.getLoggingContext(namespaceId, appId, programId, ProgramType.valueOfCategoryName(programType));
doNext(logReader, responder, loggingContext, maxEvents, fromOffsetStr, escape, filterStr, null, format, suppress);
}
Aggregations