find command is the clue here. It will split the output so it sends each line as a separate line.
But for /system resources the find is missing.
You have the usual print, but not find
/system resource>
.. -- go up to system
cpu --
export -- Print or save an export script that can be used to restore configuration
get -- Gets value of item's property
irq -- Interrupt Request usage information
monitor -- Monitor CPU and memory usage
pci -- List of all PCI devices
print -- Print values of item properties
usb -- List of all USB devices
If I go to cpu, find is there:
/system resource cpu>
.. -- go up to resource
find -- Find items by value
get -- Gets value of item's property
print -- Print values of item properties
Any tips on how to get the /system resources out as line by line?
Don’t use “print as-value” if you don’t need it. Learn how to use find and get.
Your example doesn’t work, because there is no “dynamic” entry in system resources. Without “dynamic” it should work:
log info message=[/system resource print as-value]
Please, look at this:
log info message=[/system resource get free-memory]
And generally - when you do /system resource get - you’ll see the values you can just obtain. Then you can do it in smart way, for example:
:local freemem [/system resource get free-memory];
:local totmem [/system resource get total-memory];
:log info message="Free memory: $freemem bytes out of $totmem bytes";
Or maybe:
:local freemem ([/system resource get free-memory]/1000000);
:local totmem ([/system resource get total-memory]/1000000);
:log info message="Free memory: $freemem MB out of $totmem MB";