Friday, January 29, 2016

Nice linux trick for finding the opened log files by a process

Looking for the location of your error.log (nginx) ?

Check this post by slash4:

You can use lsof (list of open files) in most cases to find open logfiles without knowing the configuration:
find PID of httpd (same concept applies for nginx and other programs):
# ps axu |grep httpd
root     17970  0.0  0.3 495964 64388 ?        Ssl  Oct29   3:45 /usr/sbin/httpd
Then search for open logfiles using lsof for the PID:
# lsof -p 17970 |grep log
httpd   17970 root    2w   REG             253,15     2278      6723 /var/log/httpd/error_log
httpd   17970 root   12w   REG             253,15        0      1387 /var/log/httpd/access_log
you can read a little more here

No comments:

Post a Comment

Ubuntu 12.04, 14.04, 16.04 - auto start an app or script before login

To run a command or application at startup, even before the user has logged in, you can use this file: /etc/rc.local The commands entered...