Logging: How can I discover what process had ran under a PID, if the process was killed?
from theshatterstone54@feddit.uk to linux@lemmy.ml on 27 Sep 2024 09:28
https://feddit.uk/post/17953172

More specifically,

How can I discover what process had ran under a PID, if the process ran under a graphical session which restarted because of a crash, and then I killed it (the session)? It’s not in the session’s logs (it was COSMIC, so I ran it with RUST_BACKTRACE=1 and redirected the output to a file; nothing, other than a PID for a process that’s no longer there).

The error in the COSMIC logs was “PID 22842 does not belong to any known session”. I have reason to believe the process is a foot terminal launched by a systemd user service, which ran a script that launched the terminal(s). But I need to be sure, so I know what I’m dealing with, and I can approach it the right way.

Any help, info, or pointers would be greatly appreciated. Thank you.

#linux

threaded - newest

Strit@lemmy.linuxuserspace.show on 27 Sep 2024 09:46 next collapse

journalctl lists PIDs, so it might have a corresponding executable name with it.

theshatterstone54@feddit.uk on 27 Sep 2024 10:25 collapse

Good idea, but I couldn’t find it

graycube@lemmy.world on 27 Sep 2024 10:45 collapse

There are some monitoring tools which take a snapshot of the process table every few minutes. If you happen to run one of those, and your process happens to be running when the snapshots is taken you can catch it.

If this is a postgresql server and you have logging turned up with pids being logged, and the pin in question was a database process, you can probably find it in the database logs.