in src/main/java/com/aliyun/openservices/log/sample/LogtailConfigSample.java [95:142]
public void UpdateConfig() {
Config config = new Config(testConfigName);
JSONObject inputDetail = new JSONObject();
inputDetail.put("logType", "apsara_log");
inputDetail.put("logPath", "/var/log/httpd1/");
inputDetail.put("filePattern", "access1.log");
inputDetail.put("localStorage", false);
inputDetail.put("timeFormat", "%h");
inputDetail.put("logBeginRegex", "\\w+");
inputDetail.put("regex", "(\\w+) (\\w+)");
inputDetail.put("topicFormat", "none");
JSONArray key = new JSONArray();
key.add("name3");
key.add("seqno3");
inputDetail.put("key", key);
JSONArray filterKey = new JSONArray();
inputDetail.put("filterKey", filterKey);
JSONArray filterRegex = new JSONArray();
inputDetail.put("filterRegex", filterRegex);
try {
config.SetInputDetail(inputDetail);
} catch (LogException e) {
e.printStackTrace();
}
JSONObject outputDetail = new JSONObject();
outputDetail.put("projectName", "ay421");
outputDetail.put("logstoreName", "perfcounter1");
try {
config.SetOutputDetail(outputDetail);
} catch (LogException e) {
e.printStackTrace();
}
try {
UpdateConfigResponse res = client.UpdateConfig(project, config);
System.out.println("RequestId:" + res.GetRequestId());
Thread.sleep(100);
} catch (LogException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}