private boolean checkFileNameForTime(String newFileName, WatchEntity entity) {
        /* Get the data time for this file. */
        PathDateExpression dateExpression = entity.getDateExpression();
        if (dateExpression.getLongestDatePattern().length() != 0) {
            String dataTime = getDataTimeFromFileName(newFileName, dateExpression);
            LOGGER.info("file {}, fileTime {}", newFileName, dataTime);
            if (!DateUtils.isValidCreationTime(dataTime, entity.getCycleUnit(), timeOffset)) {
                return false;
            }
        }
        return true;
    }
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