Quick project inventory of your Platform.sh projects


To quickly iterate through all your Platform.sh projects and check if they still receive traffic.


You will need:


If you manage a lot of Platform.sh projects, this simple shell command will iterate through all of them and list the last lines of the project’s access log, allowing you to easily check if they still receive traffic.


1. Copy the script

Copy the script below into a project_check.sh file on your local computer and run it.

for i in `platform p:list --format csv | grep -v ID | awk '{split($0,a,","); print a[1];}' `;
    echo "=== Project $i ==="
    prod_env=`platform e:list -p $i --format csv | grep production | awk '{split($0,a,","); print a[1];}'`
    echo "--- Logs of production environment $prod_env ---"
    platform log -p $i -e $prod_env access | tail -5
echo ""


You can adjust the “-5” parameter to a higher value (like -10, -50 to display more log lines). If you hae any ideas to improve the script, please reply to this topic.

1 Like