# List routes’ priorities

**URL:** <https://community.traefik.io/t/list-routes-priorities/5007>\
**Category:** Traefik v2\
**Tags:** tracing\
**Created:** [March 19, 2020, 8:30am UTC](https://community.traefik.io/t/list-routes-priorities/5007 "2020-03-19T08:30:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![agilezebra](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/agilezebra/32/7487_2.png) [@agilezebra](https://community.traefik.io/u/agilezebra)\
**Post date:** [March 19, 2020, 8:30am UTC](https://community.traefik.io/t/list-routes-priorities/5007/1 "2020-03-19T08:30:09Z")

</div>

As the whole rule length / priority / offset thing has long been a source of confusion (e.g. [https://github.com/containous/traefik/issues/1962](https://github.com/containous/traefik/issues/1962) ) there really should be a way to get a dump of all the rules / routes ordered by priority, so it’s easier to see what’s going where. I can’t find this anywhere. Is it possible to get it out of the logs?

---

<div class="post-metadata">

**Author:** ![ravensorb](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/ravensorb/32/2053_2.png) [@ravensorb](https://community.traefik.io/u/ravensorb)\
**Post date:** [January 7, 2021, 6:32pm UTC](https://community.traefik.io/t/list-routes-priorities/5007/2 "2021-01-07T18:32:41Z")

</div>

This would be VERY helpful (maybe display it in the UI?)

---

<div class="post-metadata">

**Author:** ![jbd](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/jbd/32/341_2.png) [@jbd](https://community.traefik.io/u/jbd)\
**Post date:** [January 8, 2021, 10:46am UTC](https://community.traefik.io/t/list-routes-priorities/5007/3 "2021-01-08T10:46:04Z")

</div>

Hello @agilezebra,

There is no mechanism provided by Traefik.

I found some Github issues that can be related to this need:

- [Dashboard features · Issue #5667 · traefik/traefik · GitHub](https://github.com/traefik/traefik/issues/5667)
- [Method for debugging priorities in IngressRoute and/or Ingress resources · Issue #7006 · traefik/traefik · GitHub](https://github.com/traefik/traefik/issues/7006)

If you need that, as workaround, you can use the [API](https://doc.traefik.io/traefik/v2.3/operations/api/#endpoints) to fetch and extract the data from the router's configuration. The algorithm is: priority = router.priority || len(router.rule)

---

<div class="post-metadata">

**Author:** ![cakiwi](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/cakiwi/32/3205_2.png) [@cakiwi](https://community.traefik.io/u/cakiwi)\
**Post date:** [January 8, 2021, 1:54pm UTC](https://community.traefik.io/t/list-routes-priorities/5007/4 "2021-01-08T13:54:37Z")

</div>

I spent a few minutes to make a little one-liner for this, requires curl,jq and the [api enabled](https://doc.traefik.io/traefik/v2.3/operations/api/):  
edit: prettied it up using the right endpoint instead of rawdata

```auto
curl -sk https://localhost/api/http/routers | jq '[.[]|{name:.name,rule:.rule,priority:(.priority//.rule|length)}]|sort_by(.priority)|reverse' 

```

> **unchanged data**
>
> ```yaml
> curl -sk https://localhost/api/rawdata | jq '[.routers|to_entries[]| {router:.key,rule:.value.rule,priority:.value.priority}]'
> [
> {
> "router": "api@docker",
> "rule": "PathPrefix(`/api`) || PathPrefix(`/dashboard`)",
> "priority": null
> },
> {
> "router": "m@docker",
> "rule": "Host(`mine.bar.com`)",
> "priority": null
> },
> {
> "router": "w@docker",
> "rule": "Host(`foo.bar.com`)",
> "priority": null
> },
> {
> "router": "y@docker",
> "rule": "Host(`y.bar.com`)",
> "priority": 30
> }
> ]
> 
> ```

> **calculated priority**
>
> ```yaml
> curl -sk https://localhost/api/http/routers | jq '[.[]|{name:.name,rule:.rule,priority:(.priority//.rule|length)}]|sort_by(.priority)|reverse'
> {
> "router": "api@docker",
> "rule": "PathPrefix(`/api`) || PathPrefix(`/dashboard`)",
> "priority": 46
> },
> {
> "router": "y@docker",
> "rule": "Host(`y.bar.com`)",
> "priority": 30
> },
> {
> "router": "m@docker",
> "rule": "Host(`mine.bar.com`)",
> "priority": 20
> },
> {
> "router": "w@docker",
> "rule": "Host(`foo.bar.com`)",
> "priority": 19
> }
> ]
> 
> ```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/containo/original/2X/b/bd81ebdb578656e76e56ff3cc3eed021d3ba132d.png) [@system](https://community.traefik.io/u/system)\
**Post date:** [January 11, 2021, 1:54pm UTC](https://community.traefik.io/t/list-routes-priorities/5007/5 "2021-01-11T13:54:42Z")

</div>

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
