@@ -0,0 +1,2806 @@
+package de.tblsoft.solr.pipeline;%0A%0Aimport de.tblsoft.solr.pipeline.bean.Document;%0Aimport de.tblsoft.solr.pipeline.bean.Reader;%0Aimport de.tblsoft.solr.util.IOUtils;%0Aimport oi.thekraken.grok.api.Grok;%0Aimport oi.thekraken.grok.api.Match;%0A%0Aimport java.io.BufferedReader;%0Aimport java.io.InputStream;%0Aimport java.io.InputStreamReader;%0Aimport java.util.List;%0Aimport java.util.Map;%0A%0A/**%0A * Created by tblsoft on 07.02.16.%0A */%0Apublic class GCLogReader extends AbstractReader %7B%0A%0A%0A    private Grok grok;%0A%0A    private Boolean keepRaw;%0A%0A    private String filename;%0A%0A    private String currentFileName;%0A%0A    @Override%0A    public void read() %7B%0A        try %7B%0A            String conffilename = getProperty(%22filename%22, null);%0A            filename = IOUtils.getAbsoluteFile(getBaseDir(),conffilename);%0A%0A            keepRaw = getPropertyAsBoolean(%22keepRaw%22, false);%0A%0A            String grokPatternPath = %22src/main/grok/patterns/gc%22;%0A%0A            grok = Grok.create(grokPatternPath);%0A            grok.addPatternFromFile(%22src/main/grok/patterns/patterns%22);%0A            //grok.compile(%22Total time for which application threads were stopped: %25%7BBASE16FLOAT:foo1%7D seconds%22);%0A            grok.compile(%22%5E%25%7BTIMESTAMP_ISO8601:date%7D%22);%0A%0A            List%3CString%3E fileList = IOUtils.getFiles(filename);%0A%0A            for (String file : fileList) %7B%0A                currentFileName = file;%0A%0A                InputStream in = IOUtils.getInputStream(file);%0A                InputStreamReader isr = new InputStreamReader(in);%0A                BufferedReader br = new BufferedReader(isr);%0A%0A                String line;%0A%0A                while ((line = br.readLine()) != null) %7B%0A%0A                    processLine(line);%0A                %7D%0A                br.close();%0A            %7D%0A            executer.end();%0A%0A%0A        %7D catch (Exception e) %7B%0A            throw new RuntimeException(e);%0A        %7D%0A%0A%0A    %7D%0A%0A    void processLine(String line) %7B%0A%0A        //executer.field(%22raw%22, line);%0A%0A%0A        System.out.println(line);%0A        Match gm = grok.match(line);%0A%0A        gm.captures();%0A        Map%3CString, Object%3E m = gm.toMap();%0A        Document document = new Document();%0A        for (Map.Entry%3CString, Object%3E entry : m.entrySet()) %7B%0A            Object value = entry.getValue();%0A            document.addField(entry.getKey(),String.valueOf(value));%0A        %7D%0A%0A        if (!m.isEmpty()) %7B%0A            document.addField(%22filename%22, currentFileName);%0A            if (keepRaw) %7B%0A                document.addField(%22raw%22, line);%0A            %7D%0A            executer.document(document);%0A        %7D%0A%0A    %7D%0A%0A%0A    @Override%0A    public void setPipelineExecuter(PipelineExecuter executer) %7B%0A        this.executer = executer;%0A    %7D%0A%0A    @Override%0A    public void end() %7B%0A%0A    %7D%0A%0A    @Override%0A    public void setReader(Reader reader) %7B%0A        this.reader = reader;%0A    %7D%0A%7D%0A

add gc log reader