Guest User

Untitled

a guest
Aug 30th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. public static void main(String[] args) {
  2. JSONObject object = new JSONObject();
  3. JSONObject content = new JSONObject();
  4. JSONObject metadata = new JSONObject();
  5. 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";
  6.  
  7.  
  8. content.put("text", text);
  9. JSONArray timestampFormats = new JSONArray();
  10. timestampFormats.add("yyyy-MM-dd'T'HH:mm:ssZ");
  11. object.put("timestampFormats", timestampFormats);
  12. metadata.put("timestamp", "2016-07-17T07:20:01Z");
  13. content.put("metadata", metadata);
  14. object.put("content", content);
  15. object.put("datasource", "NSX_LOG");
  16.  
  17. VMware_NSXSplitter splitter = new VMware_NSXSplitter();
  18. ArrayList<JSONObject> splitLogRecords = null;
  19. System.out.println("-------------Input text");
  20. System.out.println(object.toString());
  21. try {
  22. splitLogRecords = splitter.split(object);
  23. System.out.println("-------------Splitter output");
  24. System.out.println(splitLogRecords.toString());
  25. } catch (Exception e) {
  26. // TODO Auto-generated catch block
  27. e.printStackTrace();
  28. }
  29. }
Add Comment
Please, Sign In to add comment