/root/logfile_storage/ contains the accumulated /var/log/ file content, but not the “syslog”, if you mean that literally. E.g. /var/log/syslog is created by rsyslog from what it gets from systemd-journald, hence requires full logging option.
However, systemd-journald runs and logs anyway (to RAM) and instead of having another daemon that writes those logs to a plain text file, you can access them directly via: journalctl Use journalctl -u dietpi-ramlog to see logs for the dietpi-ramlog service, likewise for any other particular service/unit/target/mount, and you can sort and filter and format the output in many ways.
Issue: @MichaIng In Python I add the system logger to the python logger by
You could transfer /root/logfile_storage/syslog then. But if it’s about the own messages, and if they must be up-to-date and persistent/complete, easiest is to log them to a file elsewhere. That way it is also assured that the file is not written to while being transferred to the server. It could be inside /tmp, if you prefer to keep it in RAM (not boot persistent then).
You could also log them to the actual syslog and also receive them from there, like:
Does the file exist in /var/log/syslog? Otherwise obviously your Python script did not log something yet, or it failed to do so? Note that root permissions are required to create new files in /var/log.
maybe we are talking differently here. I have no syslog (as a file or directory). I want to add a python logger to log to system logs, so that it appears there.
As far as I understood dietpi uses option ramlog #1 and #2 to reduce SSD usage. So it is a concept of two layered process. One is logging temporarily and for example in #2 you copy every hour to somewhere else. So in this case there is no syslog as a file or directory, that is what I understood (and see)?
So I have a process which definitely runs longer than 1 hour, possibly 7-8 hours. It runs once a week.
I have to first look into the ssd stored log and then into the ram file log. I have to put them virtually together to have one log for my complete process, I guess.
My questions are:
Is there a one to one copy from /var/tmp/dietpi/* to /var/logs ? Or where else? I did not find a copy of dietpi-ramlog.log somewhere else…
Or is dietpi-ramlog.log to somewhere else? Is there a mapping table for copying?
Information any where on this?
How can I configure the time when the log is copied from ram to ssd? Or when is it?
The documentation on dietpi , I have read, but there is not such detailed information.
Maybe I misunderstood documentation here, but I wanted to use ram_log #2 as mentioned above, not #1 (only mentioned for completeness). this log is stored permanently on disk every hour. Am I wrong here?
What we do is quite simple. Copy everything that is available in /var/log to /root/logfile_storage. If there is no /var/log/syslog, it will not be copied. For this you might need to install rsyslog. The logs are moved once a hour. The execution time for all our jobs can be adjusted using dietpi-cron
Simple is quite good. Things get complicated by its own…
But if I use syslog I give up the advantages of having a ramlog based log, right? So I must live with the spread log files, but for most common message, diepi-.ramlog.log is used?
Or in other words, the two dietpi logs are under your maintenance and the rest is side applications. I have no clue how system log works really in depth, I only assume, that every message of Interest is somehow registered to be logged in syslog. What happens, if there is no syslog? Maybe the apps on report to their “own” owned log?
DietPi don’t has own logs. The base OS is using journald for majority of logs. And some application doing logs down to /var/log by it’s own. However we try to to configure most of them to use journald.
You could try to install rsyslog if you need /var/log/syslog. This should be possible on all logging options.