Forum Discussion

avidCoder's avatar
Super Contributor
6 years ago

How to read the logs from PUTTY using Ready API

While testing the rest API using ReadyAPI, I have come up with a scenario where I need to login to putty to validate the logs. Is there any way to write any automation script in ReadyAPI tool so that when my automation script run then automatically it logs into the putty and validate the logs.


I have tried below groovy script ( - This soluton was provided by Lucian 'cmd /c D:\\applications\\putty\\putty.exe -ssh yourserver -l yourusername -pw yourpassword -m D:\\applications\\putty\\commands.txt'.execute()
I am able to invoke putty but the commands are not working.

And inside file.txt - I have provided my commands which I need to run after I logged in to putty. 


Please provide some help Lucian 

1 Reply

  • I am novice to this tool and the commnnity also. I am able to invoke the putty by above code but I don't want to invoke it. I want to run it in back ground. And I have some commands which I need to run in putty after system logs into putty.

    below are the commands which i want to execute in putty after i logged in:-


    sudo su - user
    cd /var/opt/user/logs
    grep "someString" allTheLogs.log


    I tried to convert the above commands into .bat file and calling to the function. But it didn't work:-

    Process proc = Runtime.getRunTime.exec("C://Users//ABC//bat//logic.bat")

    After that this allTheLogs.log will contain all the logs which is fetched by putty. 

    I need to verify the logs data with my data.

    Please help me to resolve this issue. Any leads would be appreciated.


    HimanshuTayal - Any support would be appreciated.