Log retention only for a period of time

Hi guys, is it possible to preserve log from a certain interval? Saying the retention period is 30d but we wish to keep log inside a period of time (maybe an incident period) for more days than 30d. Which means prevent deleting log chunks inside this period when it reach 30d.

This might be helpful because in many cases we only care about logs in that period of time

You can override retention period for a specific log stream (see Log retention | Grafana Loki documentation), but I don’t think you can override a default retention with a longer period, at least I haven’t tried. You should certainly give it a try.

My recommendation would be:

  1. Set your default retention to be as long as you’d like incident logs to be. Then override elsewhere as needed, or,
  2. Export your incident logs during incident review, and attach it to whatever ticketing system you are using as a long-term copy.
1 Like