Explore Logs showing "No service matched your search" if no recent logs regardless of time range

Hi, I am running alloy on a host and have alloy configured to send journald logs to grafana and filtering by the systemd unit. Everything works fine and I can query the logs in grafana cloud.

However, what I find strange is that when I look at Explore > Logs - unless there was a very recent log, the UI just shows me this “no service match” error even if I select a time range (24h) where I know there are logs entries:
image

But if I query the logs directly, the entries are shown in the result

For the purposes of illustrating the issue, I generated a log entry from my app as I am typing this post and now when I go back to Explore > Log and set the time range to 6h, the latest entry AND the ones from earlier this morning shows up

This behavior seems strange to me. I would expect that when I explore the logs, depending on what time range I select, it should show me all logs for that time range but right now, it only shows me logs only if there is a recent log entry emitted.

Hi @john, is your Loki instance self hosted? If so, do you have the volume endpoint enabled, and are you using a TSDB schema?

Hi Trevor,

You’ll need to excuse me as I’m still learning grafana.

No, not self hosted loki, I am sending the logs via alloy to logs-prod-00x.grafana.net

So the only thing I have running on my host is alloy with loki.source.journal configured with a loki.write that points to grafana cloud loki instance.

Hopefully that makes sense and answers your question.

Ahh, well that makes this even more puzzling then, but doesn’t sound like a misconfiguration.

My use case here is most likely unique, given that my app does not generate logs as frequently as a typical app would so I’m probably hitting some edge case.

Also just confirmed that this happens if there are no logs emitted for an hour. If the last log emitted was 55 minutes ago and I select the last 15 minutes as the time range, it would just show me “no data” but it still recognizes the service.

Past an hour, I get the “No service matched your search”.

So it seems like to me perhaps log explorer assumes any service that has not had a log entry emitted in the last hour, perhaps it’s considered an inactive service and no longer available from that UI.

Explore Logs is using Loki’s volume endpoint to discover services, so yes, if your service has not had logs during the selected time period, it will not show up. The edge case here is that since the volume endpoint uses metadata from the index, if your service has any chunk within the time range, it will return data. So, in your example, the log from 55 min ago goes in a chunk that covers a 2 hr period ending in 65 min. If you query the last 15m, that chunk is in the range, so it will find the service. However, once you’ve moved past the bounds of that chunk, it won’t.

Well, I just checked today and it looks like it’s working as expected now.

A log entry from three hours ago shows up when I select the 3 hour window.

1 Like