Script to Read Files
From Observer GigaFlow Support | VIAVI Solutions Inc.
var InputStreamReader= Java.type('java.io.InputStreamReader'); var BufferedReader = Java.type('java.io.BufferedReader'); var FileReader = Java.type('java.io.FileReader'); var utils = Java.type('ros.CROSUtils'); var now = new Date() log.warn("start") var monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Decr" ]; try { var areader = objReader = new BufferedReader(new FileReader("/opt/ros/resources/webapps/static/syslog.txt")); var line = null; while ((line = areader.readLine()) != null) { log.warn(line) var thisone = line.split(" "); thisone[0]=monthNames[now.getMonth()] thisone[1]=now.getDate() thisone[2]=now.getHours()+":"+now.getMinutes()+":"+now.getSeconds() log.warn(thisone.join(" ")) } } catch ( e) { areader.close() } log.warn("end")