in src/main/java/com/aliyun/openservices/log/common/LocalFileConfigInputDetail.java [238:331]
protected void LocalFileConfigFromJsonObject(JSONObject inputDetail) throws LogException {
try {
CommonConfigFromJsonObject(inputDetail);
this.logPath = inputDetail.getString(Consts.CONST_CONFIG_INPUTDETAIL_LOGPATH);
this.filePattern = inputDetail.getString(Consts.CONST_CONFIG_INPUTDETAIL_FILEPATTERN);
this.logType = inputDetail.getString(Consts.CONST_CONFIG_INPUTDETAIL_LOGTYPE);
if (inputDetail.containsKey(Consts.CONST_CONFIG_INPUTDETAIL_TIMEFORMAT))
this.timeFormat = inputDetail.getString(Consts.CONST_CONFIG_INPUTDETAIL_TIMEFORMAT);
else
this.timeFormat = "";
if (inputDetail.containsKey(Consts.CONST_CONFIG_INPUTDETAIL_FILEENCODING))
this.fileEncoding = inputDetail.getString(Consts.CONST_CONFIG_INPUTDETAIL_FILEENCODING);
else
this.fileEncoding = Consts.CONST_CONFIG_INPUTDETAIL_FILEENCODING_UTF8;
if (inputDetail.containsKey(Consts.CONST_CONFIG_INPUTDETAIL_PRESERVE))
this.preserve = inputDetail.getBoolean(Consts.CONST_CONFIG_INPUTDETAIL_PRESERVE);
else
this.preserve = true;
if (inputDetail.containsKey(Consts.CONST_CONFIG_INPUTDETAIL_PRESERVERDEPTH))
this.preserveDepth = inputDetail.getIntValue(Consts.CONST_CONFIG_INPUTDETAIL_PRESERVERDEPTH);
else
this.preserveDepth = 0;
if (inputDetail.containsKey(Consts.CONST_CONFIG_INPUTDETAIL_DISCARDUNMATCH))
this.discardUnmatch = inputDetail.getBoolean(Consts.CONST_CONFIG_INPUTDETAIL_DISCARDUNMATCH);
else
this.discardUnmatch = true;
if (inputDetail.containsKey(Consts.CONST_CONFIG_INPUTDETAIL_MAXDEPTH))
this.maxDepth = inputDetail.getIntValue(Consts.CONST_CONFIG_INPUTDETAIL_MAXDEPTH);
else
this.maxDepth = Consts.CONST_CONFIG_INPUTDETAUL_DEFAULTMAXDEPTH;
if (inputDetail.containsKey(Consts.CONST_CONFIG_INPUTDETAIL_TOPICFORMAT))
this.topicFormat = inputDetail.getString(Consts.CONST_CONFIG_INPUTDETAIL_TOPICFORMAT);
else
this.topicFormat = Consts.CONST_CONFIG_DEFAULT_TOPICFORMAT;
if (inputDetail.containsKey(Consts.CONST_CONFIG_INPUTDETAIL_DISCARDNONUTF8))
this.discardNonUtf8 = inputDetail.getBoolean(Consts.CONST_CONFIG_INPUTDETAIL_DISCARDNONUTF8);
else
this.discardNonUtf8 = false;
if (inputDetail.containsKey(Consts.CONST_CONFIG_INPUTDETAIL_TAILEXISTED))
this.tailExisted = inputDetail.getBoolean(Consts.CONST_CONFIG_INPUTDETAIL_TAILEXISTED);
else
this.tailExisted = false;
if (inputDetail.containsKey(Consts.CONST_CONFIG_INPUTDETAIL_ISDOCKERFILE))
this.isDockerFile = inputDetail.getBoolean(Consts.CONST_CONFIG_INPUTDETAIL_ISDOCKERFILE);
else
this.isDockerFile = false;
if (inputDetail.containsKey(Consts.CONST_CONFIG_INPUTDETAIL_DELAYSKIPBYTES))
this.delaySkipBytes = inputDetail.getLong(Consts.CONST_CONFIG_INPUTDETAIL_DELAYSKIPBYTES);
else
this.delaySkipBytes = 0;
if (inputDetail.containsKey(Consts.CONST_CONFIG_INPUTDETAIL_ADVANCED)) {
this.advanced = Advanced.fromJsonObject(inputDetail.getJSONObject(Consts.CONST_CONFIG_INPUTDETAIL_ADVANCED));
} else {
this.advanced = new Advanced(false);
}
if (inputDetail.containsKey(Consts.CONST_CONFIG_INPUTDETAIL_DOCKER_INCLUDE_ENV)) {
JSONObject dockerIncludeEnvJson = inputDetail.getJSONObject(Consts.CONST_CONFIG_INPUTDETAIL_DOCKER_INCLUDE_ENV);
for(Map.Entry<String, Object> entry : dockerIncludeEnvJson.entrySet()) {
dockerIncludeEnv.put(entry.getKey(), entry.getValue().toString());
}
}
if (inputDetail.containsKey(Consts.CONST_CONFIG_INPUTDETAIL_DOCKER_EXCLUDE_ENV)) {
JSONObject dockerExcludeEnvJson = inputDetail.getJSONObject(Consts.CONST_CONFIG_INPUTDETAIL_DOCKER_EXCLUDE_ENV);
for(Map.Entry<String, Object> entry : dockerExcludeEnvJson.entrySet()) {
dockerExcludeEnv.put(entry.getKey(), entry.getValue().toString());
}
}
if (inputDetail.containsKey(Consts.CONST_CONFIG_INPUTDETAIL_DOCKER_INCLUDE_LABEL)) {
JSONObject dockerIncludeLabelJson = inputDetail.getJSONObject(Consts.CONST_CONFIG_INPUTDETAIL_DOCKER_INCLUDE_LABEL);
for(Map.Entry<String, Object> entry : dockerIncludeLabelJson.entrySet()) {
dockerIncludeLabel.put(entry.getKey(), entry.getValue().toString());
}
}
if (inputDetail.containsKey(Consts.CONST_CONFIG_INPUTDETAIL_DOCKER_EXCLUDE_LABEL)) {
JSONObject dockerExcludeLabelJson = inputDetail.getJSONObject(Consts.CONST_CONFIG_INPUTDETAIL_DOCKER_EXCLUDE_LABEL);
for(Map.Entry<String, Object> entry : dockerExcludeLabelJson.entrySet()) {
dockerExcludeLabel.put(entry.getKey(), entry.getValue().toString());
}
}
if (inputDetail.containsKey(Consts.CONST_CONFIG_INPUTDETAIL_PLUGINDETAIL)) {
JSONObject exists = inputDetail.getJSONObject(Consts.CONST_CONFIG_INPUTDETAIL_PLUGINDETAIL);
this.pluginDetail = exists == null ? "" : exists.toString();
}
} catch (JSONException e) {
throw new LogException("FailToGenerateInputDetail", e.getMessage(), e, "");
}
}