How to monitor JournalD for Error/Fatal error messages of some particular process and start some callback if any

366 views Asked by At

How to monitor JournalD for Error/Fatal error messages of some particular process and start some callback if any. Say if some service - say Nginx posts a log with Error - some script would call. How to make such a script?

1

There are 1 answers

0
AudioBubble On BEST ANSWER

You have to use journalctl --unit darts-game-server.service --follow -o json stream and parse the output in your code. There are libs for that as well.