S3 sort in reverse chronological order #17650
-
Hey all, using the S3 sink, is there a way to format the file names so they are naturally sorted in reverse chronological order? The main usecase is I'm creating many small batches of events and want to make it faster to iterate through the recent ones. One work-around I am doing is calculating the timestamp of the events and subtracting it from a large number (similar to 9s complement), but the issue with that approach is that I cannot pad the result with leading zeroes. Alternatively, if I can format integers in VRL to pad with leading zeroes that would be helpful as well. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
The way you are doing it is the best way I can think of. I'm not quite sure what the issue is with padding the number? Given that it is over 250 years until the string length of the unix timestamp will take another digit, you should just be able to prepend the required number of zeros without worrying about increasing the length of the resulting string.
Presumably you will want to round the timestamp to avoid creating a new object every second. |
Beta Was this translation helpful? Give feedback.
The way you are doing it is the best way I can think of.
I'm not quite sure what the issue is with padding the number? Given that it is over 250 years until the string length of the unix timestamp will take another digit, you should just be able to prepend the required number of zeros without worrying about increasing the length of the resulting string.
Presumably you will want to round the timestamp to avoid creating a new object every second.