GanfengTan commented on code in PR #6048:
URL: https://github.com/apache/inlong/pull/6048#discussion_r982071894
##########
inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/utils/MetaDataUtils.java:
##########
@@ -47,16 +49,17 @@ public class MetaDataUtils {
private static final String LOG_MARK = ".log";
// standard log path for k8s
- private static final String STANDARD_OUT = "/var/log/containers";
+ private static final String FILE_NAME_PATTERN =
"(^[-a-zA-Z0-9]+)_([a-zA-Z0-9-]+)_([a-zA-Z0-9-]+)(.log)";
/**
* standard log for k8s
*
* get pod_name,namespace,container_name,container_id
*/
public static Map<String, String> getLogInfo(String fileName) {
+ Matcher matcher = Pattern.compile(FILE_NAME_PATTERN).matcher(fileName);
Review Comment:
done
##########
inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/sources/reader/file/KubernetesFileReader.java:
##########
@@ -115,7 +115,7 @@ public Map<String, String> getK8sMetadata(JobProfile
jobConf) {
return null;
}
Map<String, String> k8sInfo =
MetaDataUtils.getLogInfo(fileReaderOperator.file.getName());
- log.info("k8s information size:{}", k8sInfo.size());
+ log.info("file name is:{},k8s information size:{}",
fileReaderOperator.file.getName(), k8sInfo.size());
Review Comment:
done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]