Script to collect System Logs via SSH

Hi guys,
I currently have a My Cloud Gen1 with latest firmware 4.x.x.

Is there any way to collect the System Logs via SSH ?
I ask because I only see the GUI option. Which script is ran when that is executed?
Is there any way to output the system logs to the device?

Please advise.
Thank you,