Hi is it possible knowning the PID to read the logs of that process?
For example if I have the PID = 2345 is it possible read the standard / error output of that Process?
thanks
read the logs from a process
Re: read the logs from a process
I don't think there is any way to do this. All you can do is figure out what files are being written to by the process (use lsof) and read those files.mathys wrote:Hi is it possible knowning the PID to read the logs of that process?
For example if I have the PID = 2345 is it possible read the standard / error output of that Process?
thanks
Re: read the logs from a process
You can always find out where the logs are:
The example is drawn from rsyslogd.
Code: Select all
# cd /proc/2345/fd
# ls -l
total 0
lrwx------. 1 root root 64 Oct 12 09:48 0 -> socket:[13650]
l-wx------. 1 root root 64 Oct 12 09:48 1 -> /var/log/messages
l-wx------. 1 root root 64 Oct 12 09:48 2 -> /var/log/secure
lr-x------. 1 root root 64 Oct 12 09:48 3 -> /proc/kmsg
l-wx------. 1 root root 64 Oct 12 09:48 4 -> /var/log/maillog
l-wx------. 1 root root 64 Oct 12 09:48 5 -> /var/log/cron