Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args) {
- JSONObject object = new JSONObject();
- JSONObject content = new JSONObject();
- JSONObject metadata = new JSONObject();
- String text = "2016-07-17T07:20:01Z nsx-controller controller Request received: 127.0.0.1:51668 - - [17/Jul/2016:07:20:01 +0000] \"GET /ws.v1/control-cluster/node?fields=roles HTTP/1.1\" - - \"-\" \"Python NOXWSClient\" - \n";
- content.put("text", text);
- JSONArray timestampFormats = new JSONArray();
- timestampFormats.add("yyyy-MM-dd'T'HH:mm:ssZ");
- object.put("timestampFormats", timestampFormats);
- metadata.put("timestamp", "2016-07-17T07:20:01Z");
- content.put("metadata", metadata);
- object.put("content", content);
- object.put("datasource", "NSX_LOG");
- VMware_NSXSplitter splitter = new VMware_NSXSplitter();
- ArrayList<JSONObject> splitLogRecords = null;
- System.out.println("-------------Input text");
- System.out.println(object.toString());
- try {
- splitLogRecords = splitter.split(object);
- System.out.println("-------------Splitter output");
- System.out.println(splitLogRecords.toString());
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
Add Comment
Please, Sign In to add comment