This article will discuss how to purge the analytics data from the Druid database in order to save disk space, as it can often lead to excessive disk space usage causing various concerns in the API Portal.
This affects all API Developer Portal versions with Druid as the Analytics engine.
The disk space for the /var/lib/docker/overlay partition on the Docker portal has grown close to 100%. A review of the biggest files in this partition, by using the following command, shows the Druid database taking most of the space. This is caused by storing too much data in Analytics.
du -a /var/lib/docker/overlay | sort -n -r | head -n 20
138831144 /var/lib/docker/overlay
129477500 /var/lib/docker/overlay/xxxxxx
64883196 /var/lib/docker/overlay/xxxxxx/merged
64594524 /var/lib/docker/overlay/xxxxxx/merged/var
64594452 /var/lib/docker/overlay/xxxxxx/merged/var/druid
64594288 /var/lib/docker/overlay/xxxxxx/upper
64593772 /var/lib/docker/overlay/xxxxxx/upper/var
64593764 /var/lib/docker/overlay/xxxxxx/upper/var/druid
60825840 /var/lib/docker/overlay/xxxxxx/merged/var/druid/indexing-logs
60825008 /var/lib/docker/overlay/xxxxxx/upper/var/druid/indexing-logs
The Portal analytics data is stored for 731 days by default. You can change this setting by running the following commands. Please note if you change the days then the data after those many days will be removed.
This will keep the 100 days worth of analytics data in the Druid database. You can use any number for the days as it fits your use case.
***The data will be permanently deleted after setting the new value***
Please make sure to try these steps in the non-production server first to observe the results before trying it in the live production server.