You can define an YANG action to call your script.
Check the "man tailf_yang_extensions" man page example:
tailf:action reboot {
tailf:exec '/opt/sys/reboot.sh' {
tailf:args '-c $(context) -p $(path)';
}
input {
leaf when {
type enumeration {
enum now;
enum 10secs;
enum 1min;
}
}
}
}