|
@ -1,6 +1,6 @@
|
|
package com.yihu.wlyy.analysis.etl;
|
|
package com.yihu.wlyy.analysis.etl;
|
|
|
|
|
|
import com.yihu.wlyy.analysis.model.DataModel;
|
|
|
|
|
|
import org.json.JSONObject;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
@ -10,7 +10,7 @@ import java.util.Map;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 日志信息分析提取
|
|
* 日志信息分析提取
|
|
*
|
|
|
|
|
|
* <p>
|
|
* Created by lyr-pc on 2017/2/17.
|
|
* Created by lyr-pc on 2017/2/17.
|
|
*/
|
|
*/
|
|
public class LogDataTransform {
|
|
public class LogDataTransform {
|
|
@ -37,7 +37,7 @@ public class LogDataTransform {
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public static LogDataTransform getLogTransform() {
|
|
public static LogDataTransform getLogTransform() {
|
|
if(instance == null) {
|
|
|
|
|
|
if (instance == null) {
|
|
synchronized (obj) {
|
|
synchronized (obj) {
|
|
if (instance == null) {
|
|
if (instance == null) {
|
|
instance = new LogDataTransform();
|
|
instance = new LogDataTransform();
|
|
@ -52,12 +52,12 @@ public class LogDataTransform {
|
|
*
|
|
*
|
|
* @param log
|
|
* @param log
|
|
*/
|
|
*/
|
|
public void transform(DataModel log) {
|
|
|
|
|
|
public void transform(JSONObject log) {
|
|
try {
|
|
try {
|
|
ILogTransform transform = transforms.get(log.getLogType());
|
|
|
|
|
|
ILogTransform transform = transforms.get(log.getString("logType"));
|
|
|
|
|
|
if (transform == null) {
|
|
if (transform == null) {
|
|
logger.error("logType:" + log.getLogType() + " transform can not find");
|
|
|
|
|
|
logger.error("logType:" + log.getString("logType") + " transform can not find");
|
|
} else {
|
|
} else {
|
|
transform.transform(log);
|
|
transform.transform(log);
|
|
}
|
|
}
|
|
@ -104,7 +104,7 @@ public class LogDataTransform {
|
|
logger.info("log transform init success");
|
|
logger.info("log transform init success");
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
logger.error("log transform init failed");
|
|
|
|
|
|
logger.error("log transform init failed:" + e.getMessage());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|