Solution
A potential solution for saving data with different rates is shown in the snippet below:
You can simply eliminate data you don't need to save by calculating average of multiple samples, and save the result only. This helps with managing the memory on the disk.
The advantage of calculating an average instead of saving 1 in 500 samples is that you don't receive unexpected peaks in the logged data.