I would like to answer the query.
You can use either CLI or API to remove the logs. You need to provide login information to access the metadata.
Another way to achieve the same is :
1. Create a bash script on your staging host and provide the login information into it.
2. Execute the bash script using post-Hook.