private String getDataTimeFromFileName(String fileName, PathDateExpression dateExpression) {
        /*
         * TODO: what if this file doesn't have any date pattern regex.
         *
         * For this case, we can simple think that the next file creation means the last task of this conf should finish
         * reading and start reading this new file.
         */
        // Extract data time from file name
        String fileTime = DateUtils.getDateTime(fileName, dateExpression);

        /**
         * Replace any non-numeric characters in the file time
         * such as 2015-09-16_00 replace with 2015091600
         */
        return fileTime.replaceAll("\\D", "");
    }
Watch directory, if new valid files are created, create instance correspondingly.
inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/task/logcollection/local/FileTask.java