You want to read the logBuffer property, I guess.
I didn't test this script (I don't have a BACnet device with a trend log on hand), but I adapted it from this thread to print the LogRecord objects in the 'logBuffer' property of Trend Log object number 1: https://forum.infiniteautomation.com/topic/3117/bacnet-scheduler
//Get the local device config from a configured bacnet data source.
//Edit DS XID
var localDeviceConfig = com.serotonin.m2m2.db.dao.DataSourceDao.instance.getByXid("DS_354e2188-4867-431b-9051-bca39b011ed7").getLocalDeviceConfig();
localDeviceConfig = com.serotonin.ma.bacnet.device.LocalDeviceDwr.getLocalDevice(localDeviceConfig);
var listener = new com.serotonin.ma.bacnet.ScriptableDeviceEventListener();
listener.registerListenerExceptionHandler( function(excp) { print("Listener Exception"); });
listener.registerIAmReceivedHandler( function(removeDevice) {print("Remote device");});
listener.registerAllowPropertyWriteHandler( function(from, obj, pv) {print("Allow property write");});
listener.registerPropertyWrittenHandler( function(from, obj, pv) {print("Property written");});
listener.registerIHaveReceivedHandler( function(removeDevice, removeObject) {print("I have received");});
listener.registerCovNotificationReceivedHandler( function(subIdentifier, initDeviceIdentifier, monitoredObjectIdentifier,
timeRemaining, listOfValues) {print("COV notification");});
listener.registerEventNotificationReceivedHandler( function(processIdentifier, initDeviceIdentifier, eventObjectIdentifier, timestamp,
notificationClass, priority, eventType, messageText, notifyType, ackRequired, fromState, toState, eventValues)
{print("Register event notification received");});
listener.registerTextMessageReceivedHandler( function(textMessageSourceDevice, messageClass, messagePriority, message)
{print("Text message received");});
listener.registerSynchronizeTimeHandler( function(from, dateTime, utc) {print("Sync time received");});
listener.registerRequestReceivedHandler( function(from, service) {print("Request received");});
var localDevice = com.serotonin.ma.bacnet.device.LocalDeviceFactory.getLocalDevice(localDeviceConfig, listener);
//print(localDevice);
try {
//Create the read request... See com.serotonin.bacnet4j.type.enumerated.ObjectType for object types
var objectIdentifier = new com.serotonin.bacnet4j.type.primitive.ObjectIdentifier(com.serotonin.bacnet4j.type.enumerated.ObjectType.trend Log, 1); //EDIT: object instance number
var propertyIdentifier = com.serotonin.bacnet4j.type.enumerated.PropertyIdentifier.logBuffer;
var readRequest = new com.serotonin.bacnet4j.service.confirmed.ReadPropertyRequest(objectIdentifier, propertyIdentifier);
//Get the remote device and send the request, edit the remote device number
var remoteDevice = localDevice.getRemoteDeviceBlocking(123);
var result = localDevice.send(remoteDevice, readRequest).get();
//result should be a read service ack that we can hopefully get a com.serotonin.bacnet4j.type.constructed.BACnetArray of com.serotonin.bacnet4j.type.constructed.LogRecord from
var logRecords = result.getValue(); //now iterate this list and do what
for(var k = 0; k < logRecords.size(); k+=1) {
print(logRecords.get(k).toString());
}
} finally {
com.serotonin.ma.bacnet.device.LocalDeviceFactory.releaseLocalDevice(localDevice, listener);
}
You may need to edit the data source xid, object instance number, and remote device id, as noted in the comments.