# The previous day's data cannot be queried in the grafana UI, but it can be successfully returned using an API request

**URL:** <https://community.grafana.com/t/the-previous-days-data-cannot-be-queried-in-the-grafana-ui-but-it-can-be-successfully-returned-using-an-api-request/106234>\
**Category:** Grafana Loki\
**Tags:** api, loki, query-help\
**Created:** [October 24, 2023, 6:49am UTC](https://community.grafana.com/t/the-previous-days-data-cannot-be-queried-in-the-grafana-ui-but-it-can-be-successfully-returned-using-an-api-request/106234 "2023-10-24T06:49:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![everhopeful](https://avatars.discourse-cdn.com/v4/letter/e/5f9b8f/32.png) [@everhopeful](https://community.grafana.com/u/everhopeful)\
**Post date:** [October 24, 2023, 6:49am UTC](https://community.grafana.com/t/the-previous-days-data-cannot-be-queried-in-the-grafana-ui-but-it-can-be-successfully-returned-using-an-api-request/106234/1 "2023-10-24T06:49:58Z")

</div>

Hi there,

I have encountered an issue while querying my Loki instance via Grafana.

My current set up involves Loki version 2.9.1 and Grafana version 8.3.5. I’m trying to retrieve logs from my Loki instance through Grafana’s explore view but despite setting the same time range as my cURL requests to the `/loki/api/v1/query` endpoint of the Querier component, I’m not receiving any data in Grafana.

Interestingly, these cURL requests to Loki are successful and return the expected data for exactly the same time range. The datasource in Grafana is configured to use the Querier component’s port 3100.

Here are some screenshots illustrating the issue:

 ![grafana_datasource](https://us1.discourse-cdn.com/grafana/original/3X/c/5/c5b78a64f729c4b2bd4e11589a18883dd16a3741.jpeg)  
 ![grafana_query](https://us1.discourse-cdn.com/grafana/original/3X/5/1/512718cd293a74e5872e69ceae06ae5b85bf6973.jpeg)  
 ![local_curl_query](https://us1.discourse-cdn.com/grafana/original/3X/b/b/bbda04dbb70356c5ce8257b42237156c4662ac48.jpeg)  
 ![querier_info](https://us1.discourse-cdn.com/grafana/original/3X/6/c/6cae55fc781fd92be623d98f887728254682ddcf.jpeg)

Could someone please help me understand why this might be happening?

Thank you so much for your assistance!

---

<div class="post-metadata">

**Author:** ![everhopeful](https://avatars.discourse-cdn.com/v4/letter/e/5f9b8f/32.png) [@everhopeful](https://community.grafana.com/u/everhopeful)\
**Post date:** [October 24, 2023, 12:39pm UTC](https://community.grafana.com/t/the-previous-days-data-cannot-be-queried-in-the-grafana-ui-but-it-can-be-successfully-returned-using-an-api-request/106234/2 "2023-10-24T12:39:59Z")

</div>

Sorry for the mistake, I’m using the `/loki/api/v1/query` interface, which only queries for the current time.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/grafana/original/2X/e/ef5308cc58c9e5a13187b5012eb99f406928462f.png) [@system](https://community.grafana.com/u/system)\
**Post date:** [October 23, 2024, 12:40pm UTC](https://community.grafana.com/t/the-previous-days-data-cannot-be-queried-in-the-grafana-ui-but-it-can-be-successfully-returned-using-an-api-request/106234/3 "2024-10-23T12:40:30Z")

</div>

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