12

When setting up graphite I accidentally set the retention to 1800 days not 180 days.

'10s:6h,10min:1800d'

From what I understand changing the retention now won't clean up the old data. I am unsure of how todo this without destroying all the data we have and starting agin.

henry.oswald
  • 5,304
  • 13
  • 51
  • 73
  • 1
    your answer will be [here](https://gist.github.com/kirbysayshi/1389254) I'm unsure the data would be lost or not when resizing to shorter, you'll have to test on a backup file first I think. (I don't have time to write an answer, if someone want to write something complete, go ahead) – Tensibai May 07 '15 at 16:27

1 Answers1

20

You have to user the whisper-resize.py command. Note that every metric is saved in a .wsp file, so if you want to change the retention policy of all metrics you will have to use a command along the lines of this gist:

find ./ -type f -name '*.wsp' -exec whisper-resize.py --nobackup {} 10s:6h 10min:180d \;
dukebody
  • 7,025
  • 3
  • 36
  • 61
  • 3
    Don't you ever try to run this script as root! It recreates files owned by root and your app is unable to write to them anymore if it's not running as root respectively – thepolina Mar 03 '17 at 05:17
  • 2
    You will want to stop the carbon process before running this lest you corrupt data due to concurrent write access – Spacemoose Oct 19 '17 at 13:30