at-chat logging to file

Hi,
I am working on a project to extract LTE signal values from modems and log them to file. The modems I have do not present RSRP or RSRQ values to the Mikrotik interface, so they need to be retrieved using modem AT commands.

I have the following script file working:
:global “rsrp”;

/interface lte at-chat lte2 input=“AT+ZSRSP?” as-value;
:log info $“rsrp”;This creates several lines in my log file with two carriage returns and an “OK” as below:
output: +ZSRSP:“-096.30”,“-08.80”,“-068.00”,“7”

OK

How can I filter that so that the log file contains only the line with the information, removing the CRs and “OK”?

Thanks,

Alan

alanpatx

I hope this “file” is not at RB NAND but on external disk (to prevent Bad Blocks).
Better way is send signals to remote syslog what you can do via logging.
.

The modems I have do not present RSRP or RSRQ values to the Mikrotik interface, so they need to be retrieved using modem AT commands.
/interface lte at-chat lte2 input=“AT+ZSRSP?” as-value;
output: +ZSRSP:“-096.30”,“-08.80”,“-068.00”,“7”
How can I filter that so that the log file contains only the line with the information, removing the CRs and “OK”?

Try this:

[marcin.przysowa@SXTR_LTE6] > put [interface lte at-chat lte1 input="ati" wait=no as-value ]
output=MikroTik
OK
[marcin.przysowa@SXTR_LTE6] > put ([interface lte at-chat lte1 input="ati" wait=no as-value ]->"output")     
MikroTik

Please play with this: https://wiki.mikrotik.com/wiki/Manual:Scripting and: len put pick