--- title: Upgrading weight: 250 --- # Upgrading Grafana Loki Every attempt is made to keep Grafana Loki backwards compatible, such that upgrades should be low risk and low friction. Unfortunately Loki is software and software is hard and sometimes we are forced to make decisions between ease of use and ease of maintenance. If we have any expectation of difficulty upgrading we will document it here. As more versions are released it becomes more likely unexpected problems arise moving between multiple versions at once. If possible try to stay current and do sequential updates. If you want to skip versions, try it in a development environment before attempting to upgrade production. # Checking for config changes Using docker you can check changes between 2 versions of Loki with a command like this: ``` export OLD_LOKI=2.3.0 export NEW_LOKI=2.4.1 export CONFIG_FILE=loki-local-config.yaml diff --color=always --side-by-side <(docker run --rm -t -v "${PWD}":/config grafana/loki:${OLD_LOKI} -config.file=/config/${CONFIG_FILE} -print-config-stderr 2>&1 | sed '/Starting Loki/q' | tr -d '\r') <(docker run --rm -t -v "${PWD}":/config grafana/loki:${NEW_LOKI} -config.file=/config/${CONFIG_FILE} -print-config-stderr 2>&1 | sed '/Starting Loki/q' | tr -d '\r') | less -R ``` the `tr -d '\r'` is likely not necessary for most people, seems like WSL2 was sneaking in some windows newline characters... The output is incredibly verbose as it shows the entire internal config struct used to run Loki, you can play around with the diff command if you prefer to only show changes or a different style output. ## Main / Unreleased ### Loki #### `querier.split-queries-by-interval` flag migrated yaml path and default value. The CLI flag `querier.split-queries-by-interval` has changed it's corresponding yaml equivalent from ```yaml query_range: split_queries_by_interval: 10m ``` -> ``` limits_config: split_queries_by_interval: 10m ``` Additionally, it has a new default value of `30m` rather than `0`. This is part of it's migration path from a global configuration to a per-tenant one (still subject to default tenant limits in the `limits_config`). It keeps it's CLI flag as `querier.split-queries-by-interval`. #### Dropped support for old Prometheus rules configuration format Alerting rules previously could be specified in two formats: 1.x format (legacy one, named `v0` internally) and 2.x. We decided to drop support for format `1.x` as it is fairly old and keeping support for it required a lot of code. In case you're still using the legacy format, take a look at [Alerting Rules](https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/) for instructions on how to write alerting rules in the new format. For reference, the newer format follows a structure similar to the one below: ```yaml groups: - name: example rules: - alert: HighErrorRate expr: job:request_latency_seconds:mean5m{job="myjob"} > 0.5 for: 10m labels: severity: page annotations: summary: High request latency ``` Meanwhile, the legacy format is a string in the following format: ``` ALERT IF [ FOR ] [ LABELS