Stream logread -f SSH

I’m trying to stream a device log over SSH while saving to file on my local machine for long running tests or debug sessions. My feeling is this will avoid filling up the RAM on the target module with log files.

I have tried the command ssh root@192.168.2.2 logread -f | tee <filename> | grep <search value> and I keep getting 'sh: logread: not found`

Is there a better way to do this?

How about you do ssh 192.168.2.2 first?
Type logread after you logged in.

@jyijyi thanks for the tip but I want to stream the log to file on the host machine not the Legato target. If I ssh root@162.168.2.2 then I’m running commands on the target and if I save files they are on the target.

After you ssh login and type logread, those log will be sent to your terminal e.g. teraterm.
Then you can save it in teraterm

The issue is that none of the paths are setup from the home directory through ssh, if you use

ssh root@192.168.2.2 ‘/sbin/logread -f’

it should work.

1 Like