Save event.log when Critical alarm occur

Is there a way to create an "event.log" file in a specific folder on the gateway server when a "Critical" alarm occurs?

I hope this will help.
https://docs.inductiveautomation.com/display/DOC81/Tag+Event+Scripts#:~:text=an%20event%20overflow.-,Alarm%20Active,-The%20Alarm%20Active