I have written this regex and tested it in a regex tester, but it does not work in Alloy. It is still showing the log injection time. Can I get some advice? Thanks.
Thanks. After changing the config to 1/02/06 15:04, the new log cannot be found in any selected time range. I have tried selecting the entire years 2001, 2002, 2006, 2016, and 2025, but no new log can be found.
Any suggestions for troubleshooting? Thanks a lot.
I checked the logs using the command journalctl -f -u loki | grep sample.log and saw an error mentioning ‘has timestamp too old.’ This proves that the regex should be working.
Then, I added reject_old_samples and reject_old_samples_max_age to the Loki config file.
After restarting Loki and adding a sample log to the sample.log file, I no longer see the ‘timestamp too old’ error, but I still cannot search for the log in Grafana.
Hi all, after further study, I understand that the label is affected by the log timestamp. When a label is mapped to a log with a newer timestamp, that label no longer accepts logs with older timestamps, even if the reject_old_samples setting is enabled.
I attempted to create a new set of Alloy configuration with a new log filename and label, then appending old logs one by one in ascending order of timestamp to the new log file. No ‘timestamp too old’ error appeared because the labels were new. The new filename and label appeared in Grafana Explore quickly, but the logs still could not be found.
After a period of time, with numerous service restarts and trial and error (such as appending new logs with no timestamp), the logs suddenly became searchable in Explore.
I cannot understand the behavior, and I don’t even know how to reproduce it. Let’s see if someone knows what is happening or can help troubleshoot it together. Thanks a lot.