Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Monitoring Application for core dumps

I am planning to design an application in C/C++ that runs as demon process and collects core dumps as and when they happen along with the applications log files. Is there any way in Linux from where I can get to know an application has crashed.

like image 847
punith Avatar asked May 05 '26 12:05

punith


2 Answers

First, you can change the directory which core dump file writes. In linux, it is /proc/sys/kernel/core_pattern (see this blog)

Second, you can monitor a directory for changes, see Inotify - how to use it? - linux .

Just set the core pattern to a specific directory and monitor it for new files.

like image 51
J-16 SDiZ Avatar answered May 07 '26 00:05

J-16 SDiZ


Another option (in addition to the other good suggestions so far) might be to set up /proc/sys/kernel/core_pattern to pipe the core file to an application as it is being created, as described here. The application can e.g. decide whether to create the core file or not, where to store the core file, compress the core file on the fly, or notify another application via IPC that the core file has been created.

like image 36
Lance Richardson Avatar answered May 07 '26 02:05

Lance Richardson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!