10:24:46.83 INFO [System Manager] CPU: 47.22%. Used RAM: 2251.01 Mb
Already had changed the limits_config in Loki:
limits_config:
reject_old_samples: false
My question is… Does Promtail support this kind of timestamp format? Is there anyway to adapt this kind of format to override the final time value of the log that is stored?
I didn’t include it on porpuse because of the format in the log that use two decimals instead of three. Nevertheless, I tried without changing the reg expression and I’m receiving no labels:
Sorry for my dumb question but did you set the proper time range in Grafana to look back? Also, whati sthe output of promtail’s server /metrics? What’s the value for promtail_sent_entries_total?
My bad! I tried again setting the time range for the last 7 days and now I can see data. Despite that, I still can’t browse all the labels I configured:
If you see data it should be alright. Also, I don’t think you should add CPU and RAM usage as labels for the stream. This would create a new log stream per label value. You should rather create the labels when you query the logs. I know this is a little confusing.
Thank you @karsten !!! I’ll take your advice and leave for later the labels. Instead I’m going to focus in the time value and how to manipulate it. Since it is a log that is extracted on demand, it shouldn’t be difficult to format it to timestamp before promtail processes it.
Not working. I also tried by removing the milliseconds decimals in the reg expression, but nothing. So I figured out that it is easier to add the “YYYY-MM-DD” as a prefix for each line (the log covers the events of one day) since the it’s a “estatic” log file. Once it’s extracted, it doesn’t change again.
The objective is to create some kind of analysis based on the metrics of the log, like CPU usage. That’s why I created a group CPU as label in the stream. But again, it’s my first time working with Loki/Promtail!
Hm, maybe the regex is not working then. Could you try ^(?P<time>\d{2,2}:\d{2,2}:\d{2,2}.\d{1,3}).*$? That only matches the time. The level would be a good label as well but let’s build it up.
Hey! Turns out that the problem was the lack of date data so a entered (for now) manually in the log and now I can pass the time Label with no problems!!
Now, I have a next problem: Graph CPU asuge over time. I managed to reach this query: