How to Get Detailed Information About a Linux PID, Process ID

To get detailed information about a Linux PID you can use the strace command. If strace is not installed it can be installed via yum using the command below.

Strace Install:

bash

  1. yum install strace

Below is a sample output from using the strace command on a Litespeed web server process.

Sample Output:

bash

  1. [root@idev log]# strace -p14387
  2. Process 14387 attached - interrupt to quit
  3. [ Process PID=14387 runs in 32 bit mode. ]
  4. gettimeofday({1238523307, 358130}, NULL) = 0
  5. epoll_wait(6, {}, 1365, 100) = 0
  6. gettimeofday({1238523307, 453603}, NULL) = 0
  7. epoll_wait(6, {}, 1365, 100) = 0
  8. gettimeofday({1238523307, 553723}, NULL) = 0
  9. epoll_wait(6, {}, 1365, 100) = 0
  10. gettimeofday({1238523307, 653950}, NULL) = 0
  11. epoll_wait(6, {}, 1365, 100) = 0
  12. gettimeofday({1238523307, 753772}, NULL) = 0
  13. epoll_wait(6, {}, 1365, 100) = 0
  14. gettimeofday({1238523307, 853665}, NULL) = 0
  15. epoll_wait(6, {}, 1365, 100) = 0
  16. gettimeofday({1238523307, 953680}, NULL) = 0
  17. epoll_wait(6, {}, 1365, 100) = 0
  18. gettimeofday({1238523308, 53737}, NULL) = 0
  19. getppid() = 14383
  20. stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=3543, ...}) = 0
  21. stat64("/var/lsws/logs/access.log", {st_mode=S_IFREG|0644, st_size=872543, ...}) = 0
  22. stat64("/var/lsws/logs/error.log", {st_mode=S_IFREG|0644, st_size=1637, ...}) = 0
  23. stat64("/var/lsws/logs/stderr.log", {st_mode=S_IFREG|0644, st_size=7690737, ...}) = 0
  24. open("/tmp/lshttpd/.rtreport.tmp", O_WRONLY|O_CREAT|O_TRUNC, 0644) = 17
  25. fstat64(17, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
  26. fcntl64(17, F_SETFD, FD_CLOEXEC) = 0
  27. time(NULL) = 1238523308
  28. write(17, "VERSION: LiteSpeed Web Server/St"..., 63) = 63
  29. write(17, "BPS_IN: 0, BPS_OUT: 0, SSL_BPS_I"..., 216) = 216
  30. write(17, "REQ_RATE [dev.domain.com"..., 91) = 91
  31. write(17, "REQ_RATE [dev.domain.com]: "..., 79) = 79
  32. write(17, "REQ_RATE [_AdminVHost]: REQ_PROC"..., 71) = 71
  33. write(17, "REQ_RATE [dev2.domain.com]:"..., 82) = 82
  34. write(17, "EXTAPP [LSAPI] [dev3.domain.com"..., 187) = 187
  35. write(17, "EXTAPP [LSAPI] [dev2.domain.com"..., 207) = 207
  36. write(17, "EOF\n", 4) = 4
  37. close(17) = 0
  38. rename("/tmp/lshttpd/.rtreport.tmp", "/tmp/lshttpd/.rtreport") = 0
  39. epoll_wait(6, {}, 1365, 100) = 0
  40. gettimeofday({1238523308, 153682}, NULL) = 0
  41. epoll_wait(6, {}, 1365, 100) = 0
  42. gettimeofday({1238523308, 253579}, NULL) = 0
  43. epoll_wait(6, {}, 1365, 100) = 0
  44. gettimeofday({1238523308, 353582}, NULL) = 0
  45. epoll_wait(6, {}, 1365, 100) = 0
  46. gettimeofday({1238523308, 453573}, NULL) = 0
  47. epoll_wait(6,
  48. Process 14387 detached

As you can see there will be lots of information in the output including files that have been logged to, domains involved with the process, etc. This should easily allow you to find a loop with a specific PID if that is what your issue is.

Share