# Ingest old log file into loki using Alloy, timestamp issue

**URL:** <https://community.grafana.com/t/ingest-old-log-file-into-loki-using-alloy-timestamp-issue/161568>\
**Category:** Grafana Alloy\
**Tags:** loki\
**Created:** [February 6, 2026, 8:17pm UTC](https://community.grafana.com/t/ingest-old-log-file-into-loki-using-alloy-timestamp-issue/161568 "2026-02-06T20:17:56Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![richprice36](https://avatars.discourse-cdn.com/v4/letter/r/a88e57/32.png) [@richprice36](https://community.grafana.com/u/richprice36)\
**Post date:** [February 6, 2026, 8:17pm UTC](https://community.grafana.com/t/ingest-old-log-file-into-loki-using-alloy-timestamp-issue/161568/1 "2026-02-06T20:17:56Z")

</div>

I am trying to ingest some old logs for analysis trying to preserve the the log line date and time. I have tried everything i can think of without success. I am able to get the date and time in loki but it does use it for the entry date and time; i.e will show all the log entries in current date and time when I explore the logs or use Drilldown.

Is there any method to make loki use the log line date time , below is what I have but it does not work.

// 3. Process the logs, Extract data from log messages and add labels  
loki.process “syslog\_process” {  
forward\_to = [loki.write.default.receiver]

```auto
// Syslog formats can vary widely, so you may need to adjust this regex

```

stage.regex {  
expression = `^(?P<timestamp>\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2})\s+(?P<hostname>\S+)\s+(?P<logfile>\S+)\s+thread:(?P<thread>\S+)\s+priority:(?P<priority>\w+)\s+category:(?P<category>\S+)\s+exception:\s*(?P<exception>.+)$`  
labels\_from\_groups = false  
}

```auto
// Set the timestamp based on the extracted field

```

stage.timestamp {  
source = “timestamp”  
format = “DateTime”

}

stage.labels {  
values = {  
timestamp = “”,  
hostname = “”,  
priority = “”,  
thread = “”,  
category = “”,  
exception = “”,  
}  
}

}

in loki I have added the following

limits\_config:  
metric\_aggregation\_enabled: true  
enable\_multi\_variant\_queries: true  
reject\_old\_samples: false  
reject\_old\_samples\_max\_age: 1y  
unordered\_writes: true

Is this even possible?

Any help is much appreciated..

---

<div class="post-metadata">

**Author:** ![yosiasz](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/yosiasz/32/45847_2.png) [@yosiasz](https://community.grafana.com/u/yosiasz)\
**Post date:** [February 6, 2026, 11:56pm UTC](https://community.grafana.com/t/ingest-old-log-file-into-loki-using-alloy-timestamp-issue/161568/2 "2026-02-06T23:56:21Z")

</div>

From kapa-ai in grafana ask ai slack channel

You relax (or disable) the “reject old samples” check \*\*in Loki’s limits\_config\*\*, not in Alloy. ### Option 1 – Allow older logs by increasing the max age Increase reject\_old\_samples\_max\_age:

yaml limits\_config: reject\_old\_samples: true reject\_old\_samples\_max\_age: 336h # 14 days, for example

This raises the cutoff so Loki accepts older log timestamps before returning greater\_than\_max\_sample\_age.[[greater\_than\_max\_sample\_age]([Enforce rate limits and push request validation | Grafana Loki documentation](https://grafana.com/docs/loki/latest/operations/request-validation-rate-limits/#greater_than_max_sample_age)); [Troubleshoot ingest]([Troubleshoot log ingestion (WRITE) | Grafana Loki documentation](https://grafana.com/docs/loki/latest/operations/troubleshooting/troubleshooting-ingest/#error-greater_than_max_sample_age))] ###

Option 2 – Disable the check (not recommended)

yaml limits\_config: reject\_old\_samples: false

This turns off the age check entirely, so Loki won’t reject logs for being too old.[[Troubleshoot ingest]([Troubleshoot log ingestion (WRITE) | Grafana Loki documentation](https://grafana.com/docs/loki/latest/operations/troubleshooting/troubleshooting-ingest/#error-greater_than_max_sample_age)); [limits\_config ref]([Grafana Loki configuration parameters | Grafana Loki documentation](https://grafana.com/docs/loki/latest/configure/#limits_config))] ### Per‑tenant override You can also change these per tenant via the \*\*runtime configuration file\*\* (overrides section), instead of globally.[[greater\_than\_max\_sample\_age]([Enforce rate limits and push request validation | Grafana Loki documentation](https://grafana.com/docs/loki/latest/operations/request-validation-rate-limits/#greater_than_max_sample_age)); [limits\_config ref]([Grafana Loki configuration parameters | Grafana Loki documentation](https://grafana.com/docs/loki/latest/configure/#limits_config))]

---

<div class="post-metadata">

**Author:** ![richprice36](https://avatars.discourse-cdn.com/v4/letter/r/a88e57/32.png) [@richprice36](https://community.grafana.com/u/richprice36)\
**Post date:** [February 9, 2026, 2:51pm UTC](https://community.grafana.com/t/ingest-old-log-file-into-loki-using-alloy-timestamp-issue/161568/3 "2026-02-09T14:51:36Z")

</div>

Thanks, but I need the loki to recognize the original date time, currently loki uses it’s own date time on that is the ingest date time, I need the actual date time from the log lines.

---

<div class="post-metadata">

**Author:** ![richprice36](https://avatars.discourse-cdn.com/v4/letter/r/a88e57/32.png) [@richprice36](https://community.grafana.com/u/richprice36)\
**Post date:** [February 9, 2026, 9:53pm UTC](https://community.grafana.com/t/ingest-old-log-file-into-loki-using-alloy-timestamp-issue/161568/4 "2026-02-09T21:53:41Z")

</div>

No matter what I do with stage.timestamp it still using the tike loki received the line i.e Time is the current date instead of the date and time from the log line. Is this even possible?

---

<div class="post-metadata">

**Author:** ![richprice36](https://avatars.discourse-cdn.com/v4/letter/r/a88e57/32.png) [@richprice36](https://community.grafana.com/u/richprice36)\
**Post date:** [February 9, 2026, 10:22pm UTC](https://community.grafana.com/t/ingest-old-log-file-into-loki-using-alloy-timestamp-issue/161568/5 "2026-02-09T22:22:57Z")

</div>

![image](https://us1.discourse-cdn.com/grafana/original/3X/6/2/62608808d2943b5b1938d9dd8c6d2161902d6ccf.png)

---

<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:** [February 12, 2026, 12:54am UTC](https://community.grafana.com/t/ingest-old-log-file-into-loki-using-alloy-timestamp-issue/161568/6 "2026-02-12T00:54:44Z")

</div>

I don’t think `DateTime` is a valid format reference. See [loki.process | Grafana Alloy documentation](https://grafana.com/docs/alloy/latest/reference/components/loki/loki.process/#stagetimestamp)
