Node-red-log to dashboard

After searching the forum, I've found Node-red-log Data Export and display the log activity in dashboard.

One more question?
How to trigger the command (sudo node-red-log) automatically when there is a activity?