Sending output of multiple commands to a file

I want to collect some basic device data and save the information to a file that can be used off device. The information I want to store is something like this:

:local Resource [/system resource print]
:local Routerboard [/system routerboard print]
:local Identity [system identity print]
:local Service [/ip service print]

I want to concatenate the information with something like this:

:local DeviceInfo ($Resource $Routerboard $Identity $Service)

Then paste that information into a file.

do something with “$DeviceInfo” file=DeviceInfo.txt

Thanks again. )

I’m still looking for some coaching. :slight_smile:

In my project Mikrotik for Splunk, I do get this information using syslog to send it out of all routers. See example here: http://forum.mikrotik.com/t/tool-using-splunk-to-analyse-mikrotik-logs-3-3-graphing-everything/121810/1

In my project Mikrotik for Splunk, I do get this information using syslog to send it out of all routers.

Not what I was looking for, but I see what you did. Thanks. I’m looking to store the information directly into a file rather than a remote log server.

did you ever get this working? im trying to figure something out as well in the same vein now

Remember that high write counts of file may wear out the routers flash.

:local Resource [/system resource print]
:local Routerboard [/system routerboard print]
:local Identity [system identity print]
:local Service [/ip service print]

:local DeviceInfo ($Resource . "\r" . $Routerboard . "\r" . $Identity . "\r" . $Service)

:execute script=":put $DeviceInfo" file=DeviceInfo.txt

Better this…

:execute script="/system resource print; /system routerboard print; /system identity print; /ip service print;" file=DeviceInfo.txt