# Cannot see json logs when using alloy to forward logs to Loki

**URL:** <https://community.grafana.com/t/cannot-see-json-logs-when-using-alloy-to-forward-logs-to-loki/147343>\
**Category:** Grafana Alloy\
**Tags:** loki\
**Created:** [March 28, 2025, 10:01am UTC](https://community.grafana.com/t/cannot-see-json-logs-when-using-alloy-to-forward-logs-to-loki/147343 "2025-03-28T10:01:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jennysundstroem](https://avatars.discourse-cdn.com/v4/letter/j/839c29/32.png) [@jennysundstroem](https://community.grafana.com/u/jennysundstroem)\
**Post date:** [March 28, 2025, 10:01am UTC](https://community.grafana.com/t/cannot-see-json-logs-when-using-alloy-to-forward-logs-to-loki/147343/1 "2025-03-28T10:01:31Z")

</div>

I am new to Grafana Loki and Alloy and I want to get logs from disk to Loki using Alloy. (And possibly create traces from logs if possible.)

I have json logs on this format:  
{“@timestamp”:“2025-03-27T10:49:50.975150682+01:00”,“@version”:“1”,“message”:“Received Temp = 0.0°C, Humidity = 0.0%”,“logger\_name”:“com.home.ClimateController”,“thread\_name”:“pool-3-thread-4”,“level”:“INFO”,“level\_value”:20000,“trace\_id”:“390c7258c294f9451ce2e7c030c34a2a”,“trace\_flags”:“01”,“span\_id”:“dd5a4e0331d48324”}  
{“@timestamp”:“2025-03-27T10:49:50.983169077+01:00”,“@version”:“1”,“message”:“Temp changed by -0.0°C → 26.48°C”,“logger\_name”:“com.home.ClimateController”,“thread\_name”:“pool-3-thread-4”,“level”:“INFO”,“level\_value”:20000,“trace\_id”:“390c7258c294f9451ce2e7c030c34a2a”,“trace\_flags”:“01”,“span\_id”:“bc541a4adb9c2496”}

And have alloy running with this config:

local.file\_match “applogs” {  
path\_targets = [{ **path** = “/home/test/dev/SmartHome/logs/\*.json” }]  
}

loki.source.file “local\_files” {  
targets = local.file\_match.applogs.targets  
forward\_to = [loki.write.local\_loki.receiver]  
}

loki.write “local\_loki” {  
endpoint {  
url = “[http://localhost:3100/loki/api/v1/push](http://localhost:3100/loki/api/v1/push)”  
}  
}

Loki has the following config:

auth\_enabled: false

server:  
http\_listen\_port: 3100  
grpc\_listen\_port: 9096  
log\_level: debug  
grpc\_server\_max\_concurrent\_streams: 1000

common:  
ring:  
instance\_addr: 127.0.0.1  
kvstore:  
store: inmemory  
replication\_factor: 1  
path\_prefix: /tmp/loki

query\_range:  
results\_cache:  
cache:  
embedded\_cache:  
enabled: true  
max\_size\_mb: 100

limits\_config:  
metric\_aggregation\_enabled: true

schema\_config:  
configs:  
- from: 2020-10-24  
store: tsdb  
object\_store: filesystem  
schema: v13  
index:  
prefix: index\_  
period: 24h

storage\_config:  
filesystem:  
directory: /tmp/loki/chunks

pattern\_ingester:  
enabled: true  
metric\_aggregation:  
loki\_address: localhost:3100

ruler:  
alertmanager\_url: [http://localhost:9093](http://localhost:9093)

frontend:  
encoding: protobuf

I cannot see any logs in Grafana Loki. Not sure where I am going wrong. Is there need for any mapping of labels or other?

Also is it possible to visualize traces/spans only through the logs and how can that be done if so?

---

<div class="post-metadata">

**Author:** ![tonyswumac](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/tonyswumac/32/22401_2.png) [@tonyswumac](https://community.grafana.com/u/tonyswumac)\
**Post date:** [March 28, 2025, 5:00pm UTC](https://community.grafana.com/t/cannot-see-json-logs-when-using-alloy-to-forward-logs-to-loki/147343/2 "2025-03-28T17:00:18Z")

</div>

> [@jennysundstroem](#):
>
> url = “[http://localhost:3100/loki/api/v1/push”](http://localhost:3100/loki/api/v1/push%E2%80%9D)

This is most likely wrong unless you are running Loki and Alloy on the same host.

Check your logs on both Alloy and Loki. Check connectivity. Make sure Loki is functional with an API call.

---

<div class="post-metadata">

**Author:** ![jennysundstroem](https://avatars.discourse-cdn.com/v4/letter/j/839c29/32.png) [@jennysundstroem](https://community.grafana.com/u/jennysundstroem)\
**Post date:** [April 1, 2025, 3:33pm UTC](https://community.grafana.com/t/cannot-see-json-logs-when-using-alloy-to-forward-logs-to-loki/147343/3 "2025-04-01T15:33:08Z")

</div>

Thank you for the answer, it was nothing wrong with the endpoint but there was a root permission issue.
