when i use the curl command put a log to loki, like this
curl -X POST "https://example:port/loki/api/v1/push" \
-H "Content-Type: application/json" \
-d '{
"streams": [
{
"stream": {
"account": "demo",
"environment": "test",
"type": "application"
},
"values": [
["1735328400000000000", "{\"log_message\": \"simple log message\", \"actual_time\": \"2024-12-27T17:00:00+00:00\"}"]
]
}
]
}'
and check the log in grafana,
log and loki timestamp are different.
loki timestamp is run curl command’s time.
my loki config reject_old_samples and reject_old_samples_max_age are default.
how to fix the timestamp problem?
Try testing with a timestamp that’s not in the future (for example 1735308782000000000
, which is when i wrote this reply). You’ll need to change your labels too to avoid conflict test (say account: demo1
).
I try testing with a timestamp that’s not in the future
curl -X POST "https://example:port/loki/api/v1/push" \
-H "Content-Type: application/json" \
-d '{
"streams": [
{
"stream": {
"account": "demo1",
"environment": "test",
"type": "application"
},
"values": [
["1735308782000000000", "{\"log_message\": \"simple log message\", \"actual_time\": \"2024-12-27T02:53:02+00:00\"}"]
]
}
]
}'
In my Grafana console hava same problem.
loki timestamp still at run curl command’s time, not the log time (2024-12-27T02:53:02+00:00).
What other ways can I test to resolve this issue?