Package co.cask.cdap.logging.filter

Examples of co.cask.cdap.logging.filter.AndFilter


      new Runnable() {
        @Override
        public void run() {
          callback.init();
          try {
            Filter logFilter = new AndFilter(ImmutableList.of(LoggingContextHelper.createFilter(loggingContext),
                                                              filter));

            SortedMap<Long, Location> sortedFiles = fileMetaDataManager.listFiles(loggingContext);
            if (sortedFiles.isEmpty()) {
              return;
View Full Code Here


          callback.init();

          KafkaConsumer kafkaConsumer = new KafkaConsumer(seedBrokers, topic, partition, kafkaTailFetchTimeoutMs);
          try {
            Filter logFilter = new AndFilter(ImmutableList.of(LoggingContextHelper.createFilter(loggingContext),
                                                              filter));

            long latestOffset = kafkaConsumer.fetchOffset(KafkaConsumer.Offset.LATEST);
            long startOffset = fromOffset + 1;
View Full Code Here

          callback.init();

          KafkaConsumer kafkaConsumer = new KafkaConsumer(seedBrokers, topic, partition, kafkaTailFetchTimeoutMs);
          try {
            Filter logFilter = new AndFilter(ImmutableList.of(LoggingContextHelper.createFilter(loggingContext),
                                                              filter));

            long latestOffset = kafkaConsumer.fetchOffset(KafkaConsumer.Offset.LATEST);
            long earliestOffset = kafkaConsumer.fetchOffset(KafkaConsumer.Offset.EARLIEST);
            long stopOffset;
View Full Code Here

        @Override
        public void run() {

          callback.init();
          try {
            Filter logFilter = new AndFilter(ImmutableList.of(LoggingContextHelper.createFilter(loggingContext),
                                                              filter));

            SortedMap<Long, Location> sortedFiles = fileMetaDataManager.listFiles(loggingContext);
            long prevInterval = -1;
            Location prevFile = null;
View Full Code Here

        @Override
        public void run() {
          callback.init();

          try {
            Filter logFilter = new AndFilter(ImmutableList.of(LoggingContextHelper.createFilter(loggingContext),
                                                              filter));
            long fromTimeMs = fromOffset + 1;

            SortedMap<Long, Location> sortedFiles = fileMetaDataManager.listFiles(loggingContext);
            if (sortedFiles.isEmpty()) {
View Full Code Here

    executor.submit(new Runnable() {
      @Override
      public void run() {
        callback.init();
        try {
          Filter logFilter = new AndFilter(ImmutableList.of(LoggingContextHelper.createFilter(loggingContext),
                                                            filter));

          SortedMap<Long, Location> sortedFiles =
            ImmutableSortedMap.copyOf(fileMetaDataManager.listFiles(loggingContext), Collections.<Long>reverseOrder());
          if (sortedFiles.isEmpty()) {
View Full Code Here

    if (loggingContext instanceof ServiceLoggingContext) {
      String systemId = loggingContext.getSystemTagsMap().get(ServiceLoggingContext.TAG_SYSTEM_ID).getValue();
      String componentId = loggingContext.getSystemTagsMap().get(ServiceLoggingContext.TAG_COMPONENT_ID).getValue();
      String tagName = ServiceLoggingContext.TAG_SERVICE_ID;
      String entityId = loggingContext.getSystemTagsMap().get(ServiceLoggingContext.TAG_SERVICE_ID).getValue();
      return new AndFilter(
        ImmutableList.of(new MdcExpression(ServiceLoggingContext.TAG_SYSTEM_ID, systemId),
                         new MdcExpression(ServiceLoggingContext.TAG_COMPONENT_ID, componentId),
                         new MdcExpression(tagName, entityId)));
    } else {
      String accountId = loggingContext.getSystemTagsMap().get(ApplicationLoggingContext.TAG_ACCOUNT_ID).getValue();
      String applId = loggingContext.getSystemTagsMap().get(ApplicationLoggingContext.TAG_APPLICATION_ID).getValue();

      String tagName;
      String entityId;
      if (loggingContext instanceof FlowletLoggingContext) {
        tagName = FlowletLoggingContext.TAG_FLOW_ID;
        entityId = loggingContext.getSystemTagsMap().get(tagName).getValue();
      } else if (loggingContext instanceof ProcedureLoggingContext) {
        tagName = ProcedureLoggingContext.TAG_PROCEDURE_ID;
        entityId = loggingContext.getSystemTagsMap().get(tagName).getValue();
      } else if (loggingContext instanceof MapReduceLoggingContext) {
        tagName = MapReduceLoggingContext.TAG_MAP_REDUCE_JOB_ID;
        entityId = loggingContext.getSystemTagsMap().get(tagName).getValue();
      } else if (loggingContext instanceof SparkLoggingContext) {
        tagName = SparkLoggingContext.TAG_SPARK_JOB_ID;
        entityId = loggingContext.getSystemTagsMap().get(tagName).getValue();
      } else if (loggingContext instanceof UserServiceLoggingContext) {
        tagName = UserServiceLoggingContext.TAG_USERSERVICE_ID;
        entityId = loggingContext.getSystemTagsMap().get(tagName).getValue();
      } else if (loggingContext instanceof GenericLoggingContext) {
        entityId = loggingContext.getSystemTagsMap().get(GenericLoggingContext.TAG_ENTITY_ID).getValue();
        return createGenericFilter(accountId, applId, entityId);
      } else {
        throw new IllegalArgumentException(String.format("Invalid logging context: %s", loggingContext));
      }

      return new AndFilter(
        ImmutableList.of(new MdcExpression(FlowletLoggingContext.TAG_ACCOUNT_ID, accountId),
                         new MdcExpression(FlowletLoggingContext.TAG_APPLICATION_ID, applId),
                         new MdcExpression(tagName, entityId)
        )
      );
View Full Code Here

TOP

Related Classes of co.cask.cdap.logging.filter.AndFilter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.