001 /** 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018 019 package org.apache.hadoop.yarn.api.records; 020 021 import org.apache.hadoop.classification.InterfaceAudience.Public; 022 import org.apache.hadoop.classification.InterfaceStability.Evolving; 023 import org.apache.hadoop.classification.InterfaceStability.Unstable; 024 import org.apache.hadoop.yarn.util.Records; 025 026 /** 027 * <p><code>LogAggregationContext</code> represents all of the 028 * information needed by the <code>NodeManager</code> to handle 029 * the logs for an application.</p> 030 * 031 * <p>It includes details such as: 032 * <ul> 033 * <li>includePattern. It uses Java Regex to filter the log files 034 * which match the defined include pattern and those log files 035 * will be uploaded. </li> 036 * <li>excludePattern. It uses Java Regex to filter the log files 037 * which match the defined exclude pattern and those log files 038 * will not be uploaded. If the log file name matches both the 039 * include and the exclude pattern, this file will be excluded eventually</li> 040 * </ul> 041 * </p> 042 * 043 * @see ApplicationSubmissionContext 044 */ 045 046 @Evolving 047 @Public 048 public abstract class LogAggregationContext { 049 050 @Public 051 @Unstable 052 public static LogAggregationContext newInstance(String includePattern, 053 String excludePattern) { 054 LogAggregationContext context = Records.newRecord(LogAggregationContext.class); 055 context.setIncludePattern(includePattern); 056 context.setExcludePattern(excludePattern); 057 return context; 058 } 059 060 /** 061 * Get include pattern 062 * 063 * @return include pattern 064 */ 065 @Public 066 @Unstable 067 public abstract String getIncludePattern(); 068 069 /** 070 * Set include pattern 071 * 072 * @param includePattern 073 */ 074 @Public 075 @Unstable 076 public abstract void setIncludePattern(String includePattern); 077 078 /** 079 * Get exclude pattern 080 * 081 * @return exclude pattern 082 */ 083 @Public 084 @Unstable 085 public abstract String getExcludePattern(); 086 087 /** 088 * Set exclude pattern 089 * 090 * @param excludePattern 091 */ 092 @Public 093 @Unstable 094 public abstract void setExcludePattern(String excludePattern); 095 }