// Path: common/src/main/java/com/fksm/common/util/Constants.java
// public class Constants {
//     /** The Constant REGEX. */
//     public static final String REGEX_UUID = "regex.uuid";
//     public static final String REGEX_IP = "regex.ip";
//     public static final String REGEX_TIME = "regex.time";
// 
//     public static final int TYPE_CALLER_INFO = 1;
//     public static final int TYPE_RESP_PARAM = 2;
//     public static final int TYPE_REQ_PARAM = 3;
//     public static final int TYPE_RESP_TIME = 4;
//     public static final int TYPE_SERVICE_INFO = 5;
// 
//     public static final String REDIS_SERVER_KEY = "SERVER";
// 
//     public static final String REDIS_SERVER_SERVICE_PREFIX = "SERVER_SERVICE_";
//     public static final String REDIS_SERVICE_REQUEST_PREFIX = "SERVICE_REQUEST_";
//     public static final String REDIS_TIME_REQUESTS_PREFIX = "TIME_REQUESTS_";
//     //server->service->requests
//     public static final String REDIS_SERVER_SERVICE_REQUEST_PREFIX = "SERVER_SERVICE_REQUEST_";
// 
//     public static final String REDIS_SERVICE_COSTS_PREFIX = "SERVICE_COSTS_";
//     public static final String REDIS_SERVICE_CALLERS_PREFIX = "SERVICE_CALLERS_";
//     public static final String REDIS_SERVICE_CODES_PREFIX = "SERVICE_CODES_";
// 
//     public static final String REDIS_SERVICE_REQUEST_CALLER_PREFIX = "SERVICE_REQUEST_CALLER_";
//     public static final String REDIS_SERVER_SERVICE_COST_PREFIX = "SERVER_SERVICE_COST_";
//     public static final String REDIS_SERVICE_REQUEST_CODE_PREFIX = "SERVICE_REQUEST_CODE_";
// 
//     public static final String REDIS_SERVER_PREFIX = "S_SERVER_SERVICE_REQUEST_";
//     public static final String REDIS_SERVER_COSTS_PREFIX = "S_SERVER_SERVICE_COSTS_";
//     public static final String REDIS_SERVER_CALLER_PREFIX = "S_SERVER_SERVICE_CALLER_";
//     public static final String REDIS_SERVER_CODE_PREFIX = "S_SERVER_SERVICE_CODE_";
// 
//     public static final String REDIS_TIMELINE_KEY = "TIMELINE_KEY";
// 
//     public static final Integer CODE_SUCESS = 100;
// }


import com.alibaba.fastjson.JSON;
import com.fksm.common.dto.*;
import com.fksm.common.util.Constants;
import com.google.common.base.Charsets;
import com.google.common.collect.Lists;
import org.apache.flume.Context;
import org.apache.flume.Event;
import org.apache.flume.interceptor.Interceptor;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
            logger.error("error get result : {} from log.", e);
            return null;
        }
    }

    @Override
    public List<Event> intercept(List<Event> events) {
        List<Event> out = Lists.newArrayList();
        for (Event event : events) {
            Event outEvent = intercept(event);
            if (outEvent != null) {
                out.add(outEvent);
            }
        }
        return out;
    }

    @Override
    public void close() {
        // no-op
    }

    public static class Builder implements Interceptor.Builder {

        private Pattern uuid;
        private Pattern ip;
        private Pattern time;

        @Override
        public void configure(Context context) {
// Path: common/src/main/java/com/fksm/common/util/Constants.java
// public class Constants {
//     /** The Constant REGEX. */
//     public static final String REGEX_UUID = "regex.uuid";
//     public static final String REGEX_IP = "regex.ip";
//     public static final String REGEX_TIME = "regex.time";
// 
//     public static final int TYPE_CALLER_INFO = 1;
//     public static final int TYPE_RESP_PARAM = 2;
//     public static final int TYPE_REQ_PARAM = 3;
//     public static final int TYPE_RESP_TIME = 4;
//     public static final int TYPE_SERVICE_INFO = 5;
// 
//     public static final String REDIS_SERVER_KEY = "SERVER";
// 
//     public static final String REDIS_SERVER_SERVICE_PREFIX = "SERVER_SERVICE_";
//     public static final String REDIS_SERVICE_REQUEST_PREFIX = "SERVICE_REQUEST_";
//     public static final String REDIS_TIME_REQUESTS_PREFIX = "TIME_REQUESTS_";
//     //server->service->requests
//     public static final String REDIS_SERVER_SERVICE_REQUEST_PREFIX = "SERVER_SERVICE_REQUEST_";
// 
//     public static final String REDIS_SERVICE_COSTS_PREFIX = "SERVICE_COSTS_";
//     public static final String REDIS_SERVICE_CALLERS_PREFIX = "SERVICE_CALLERS_";
//     public static final String REDIS_SERVICE_CODES_PREFIX = "SERVICE_CODES_";
// 
//     public static final String REDIS_SERVICE_REQUEST_CALLER_PREFIX = "SERVICE_REQUEST_CALLER_";
//     public static final String REDIS_SERVER_SERVICE_COST_PREFIX = "SERVER_SERVICE_COST_";
//     public static final String REDIS_SERVICE_REQUEST_CODE_PREFIX = "SERVICE_REQUEST_CODE_";
// 
//     public static final String REDIS_SERVER_PREFIX = "S_SERVER_SERVICE_REQUEST_";
//     public static final String REDIS_SERVER_COSTS_PREFIX = "S_SERVER_SERVICE_COSTS_";
//     public static final String REDIS_SERVER_CALLER_PREFIX = "S_SERVER_SERVICE_CALLER_";
//     public static final String REDIS_SERVER_CODE_PREFIX = "S_SERVER_SERVICE_CODE_";
// 
//     public static final String REDIS_TIMELINE_KEY = "TIMELINE_KEY";
// 
//     public static final Integer CODE_SUCESS = 100;
// }


// Path: flume/src/main/java/com/fksm/flume/interceptor/CleanAndToJsonInterceptor.java
import com.alibaba.fastjson.JSON;
import com.fksm.common.dto.*;
import com.fksm.common.util.Constants;
import com.google.common.base.Charsets;
import com.google.common.collect.Lists;
import org.apache.flume.Context;
import org.apache.flume.Event;
import org.apache.flume.interceptor.Interceptor;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

            logger.error("error get result : {} from log.", e);
            return null;
        }
    }

    @Override
    public List<Event> intercept(List<Event> events) {
        List<Event> out = Lists.newArrayList();
        for (Event event : events) {
            Event outEvent = intercept(event);
            if (outEvent != null) {
                out.add(outEvent);
            }
        }
        return out;
    }

    @Override
    public void close() {
        // no-op
    }

    public static class Builder implements Interceptor.Builder {

        private Pattern uuid;
        private Pattern ip;
        private Pattern time;

        @Override
        public void configure(Context context) {
            uuid = Pattern.compile(context.getString(Constants.REGEX_UUID, ""), Pattern.MULTILINE);