EMsnap commented on code in PR #5590:
URL: https://github.com/apache/inlong/pull/5590#discussion_r949839979
##########
inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/utils/FileDataUtils.java:
##########
@@ -37,14 +38,31 @@ public class FileDataUtils {
/**
* Get standard log for k8s
*/
- public static String getK8sJsonLog(String log) {
+ public static String getK8sJsonLog(String log, Boolean isJson) {
if (!StringUtils.isNoneBlank(log)) {
return null;
}
+ if (!isJson) {
+ return log;
+ }
Type type = new TypeToken<HashMap<Integer, String>>() {
}.getType();
Map<String, String> logJson = GSON.fromJson(log, type);
- return logJson.get(KUBERNETES_LOG);
+ return logJson.getOrDefault(KUBERNETES_LOG, log);
}
+ /**
+ * To judge json
+ */
+ public static boolean isJSON(String json) {
+ boolean flag;
Review Comment:
flag is vague as a variable name
--
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]