read the logs from a process

General support questions
Post Reply
mathys
Posts: 46
Joined: 2014/11/07 10:51:04

read the logs from a process

Post by mathys » 2015/10/10 10:21:17

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

Whoever
Posts: 1361
Joined: 2013/09/06 03:12:10

Re: read the logs from a process

Post by Whoever » 2015/10/10 17:16:28

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
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.

MartinR
Posts: 714
Joined: 2015/05/11 07:53:27
Location: UK

Re: read the logs from a process

Post by MartinR » 2015/10/12 08:50:30

You can always find out where the logs are:

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
The example is drawn from rsyslogd.

Post Reply