Skip to content

query log with limit of 1000 #2226

@yangvipguang

Description

@yangvipguang

I want to know how to increase the number of limit for quering log 。Does it configure in configuration or some way to query the log with QL 。or it is hard-code in the code 。

Activity

cyriltovena

cyriltovena commented on Jun 22, 2020

@cyriltovena
Contributor

You can change it in Grafana in the datasource section of Loki.

If you use logcli it's a simple flag. If you use the API it's a query string limits.

Hope this helps.

yangvipguang

yangvipguang commented on Jun 23, 2020

@yangvipguang
Author

thanks,I have solved it. But if you set more than 5000 lines。The log query page will report an error。
image

adityacs

adityacs commented on Jun 23, 2020

@adityacs
Contributor

@yangvipguang You can change the max_entries_limit_per_query value in Loki's limits_config

yangvipguang

yangvipguang commented on Jun 23, 2020

@yangvipguang
Author

Ok,I think so. But before I do't find the setting in the limits_config configuration of document. I will try. Thanks

stale

stale commented on Jul 23, 2020

@stale

This issue has been automatically marked as stale because it has not had any activity in the past 30 days. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

added
staleA stale issue or PR that will automatically be closed.
on Jul 23, 2020
yongzhang

yongzhang commented on May 13, 2021

@yongzhang

I'm a bit confused about this:
the default value of max_entries_limit_per_query is 5000 as documented here https://grafana.com/docs/loki/latest/configuration/#limits_config,

but why I still get 1000 limit in grafana explore?

image

yongzhang

yongzhang commented on May 13, 2021

@yongzhang

^ ah I found it in datasource settings.

rufreakde

rufreakde commented on Apr 6, 2022

@rufreakde

max_entries_limit_per_query

Could you share your knowledge as to how you found the datasource settings.
And also how you edited it to change the limit. So others finding this thread in the future may directly see your findings.

yongzhang

yongzhang commented on Apr 6, 2022

@yongzhang

max_entries_limit_per_query

Could you share your knowledge as to how you found the datasource settings. And also how you edited it to change the limit. So others finding this thread in the future may directly see your findings.

image

^ change the max lines above

karuthevarbiokey

karuthevarbiokey commented on Nov 9, 2022

@karuthevarbiokey

Regardless of what value i set for max_entries_limit_per_query in values.yaml, i see that loki pod always defaults it to 5000. I tried with new installation, with upgrades, etc, it still defaults to 5000.

ryanth2022

ryanth2022 commented on Nov 16, 2022

@ryanth2022

@yongzhang the configuration to increase max lines for loki datasource will be like below
https://grafana.com/docs/grafana/latest/datasources/loki/

datasources:
  - name: Loki
    type: loki
    access: proxy
    url: http://localhost:3100
    basicAuth: true
    basicAuthUser: my_user
    jsonData:
      maxLines: 1000
      derivedFields:
9k001

9k001 commented on Dec 20, 2023

@9k001

Regardless of what value i set for max_entries_limit_per_query in values.yaml, i see that loki pod always defaults it to 5000. I tried with new installation, with upgrades, etc, it still defaults to 5000.

Me, too. How did you solve this problem?

dodream28

dodream28 commented on May 12, 2025

@dodream28

Regardless of what value i set for max_entries_limit_per_query in values.yaml, i see that loki pod always defaults it to 5000. I tried with new installation, with upgrades, etc, it still defaults to 5000.

Me, too. How did you solve this problem?

To increase the maximum number of entries returned per query in Grafana when using Loki, you'll need to modify the max_entries_limit_per_query parameter in your Loki configuration file (loki-config.yaml or similar).

By default, this value is set to 5000, which means any query in Grafana will only return up to 5,000 log entries unless specified otherwise. To raise this limit, you can set it up to a maximum of 50000.

Here’s how to update your Loki config:

limits_config:
  max_entries_limit_per_query: 50000

Make sure this setting is under the limits_config section. After updating the config file, restart your Loki instance to apply the changes.

For more details, you can refer to the official Loki configuration documentation:
🔗 https://grafana.com/docs/loki/latest/configure/

Let me know if you'd like help formatting the config file or troubleshooting the change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleA stale issue or PR that will automatically be closed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @cyriltovena@adityacs@yangvipguang@yongzhang@rufreakde

        Issue actions

          query log with limit of 1000 · Issue #2226 · grafana/loki