iCall script to add and remove iRules based on log message

Hey I’m brand new to these iCalls and trying to get a handle on how I would use a log message to add an iRule Any tips?

You don’t need a full iCall since it is a simple script, you can do it like this:

Text to add to /config/user_alert.conf

alert IRULE_ADD "text in log that triggers irule add" {
    exec command="tmsh modify ltm virtual virtual_name rules { irule_name }"
}

To remove:

alert IRULE_REMOVE "text in log that triggers irule remove" {
    exec command="tmsh modify ltm virtual virtual_name rules none"
}




If you had a bigger process that is being triggered you can do this:

alert IRULE_ADD "text in log that triggers irule add" {
    exec command=" tmsh generate sys icall event BIG_SCRIPT_EVENT"
}


Then you would have:

sys icall handler triggered BIG_SCRIPT_HANDLER {
    script BIG_SCRIPT
    subscriptions {
    BIG_SCRIPT_EVENT {
            event-name BIG_SCRIPT_EVENT
        }
    }


sys icall script BIG_SCRIPT {
    app-service none
    definition {
    script command here……
    .
    .
    }
    description “Script started by handler BIG_SCRIPT which is trigger by   BIG_SCRIPT_EVENT”
    events none
}