# problem with irules

**URL:** <https://community.f5.com/t/problem-with-irules/42463>\
**Category:** Technical Forums\
**Tags:** irules, application-delivery\
**Created:** [April 24, 2018, 7:28pm UTC](https://community.f5.com/t/problem-with-irules/42463 "2018-04-24T19:28:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Caio\_Alves\_3559](https://avatars.discourse-cdn.com/v4/letter/c/5e9695/32.png) [@Caio\_Alves\_3559](https://community.f5.com/u/Caio_Alves_3559)\
**Post date:** [April 24, 2018, 7:28pm UTC](https://community.f5.com/t/problem-with-irules/42463/1 "2018-04-24T19:28:40Z")

</div>

when RULE\_INIT{ log local0.“iRule created or updated” } when CLIENT\_ACCEPTED { log local0.“in CLIENT\_ACCEPTED” } when HTTP\_REQUEST{ log local0.“Client made an http request” } when LB\_SELECTED { log local0.“Pool member selected” } when SERVER\_CONNECTED { log local0.“Connection made with pool member” } when HTTP\_RESPONSE { log local0.“Pool member made an HTTP response.” }

Exception caught in LocalLB:⚱iControl:LocalLB/Rule::modify\_rule() Exception: Common::OperationFailed primary\_error\_code : 17236305 (0x01070151) secondary\_error\_code : 0 error\_string : 01070151:3: Rule [/Common/exercise\_iRule] error: /Common/exercise\_iRule:1: error: [wrong args][when RULE\_INIT{] /Common/exercise\_iRule:2: error: [command is not valid in the current scope][log local0.“iRule created or updated”] /Common/exercise\_iRule:3: error: [command is not valid in the current scope][}] /Common/exercise\_iRule:5: error: ["invalid argument local0.“in”][log local0.“in CLIENT\_ACCEPTED”] /Common/exercise\_iRule:7: error: [wrong args][when HTTP\_REQUEST{] /Common/exercise\_iRule:8: error: [command is not valid in the current scope][log local0.“Client made an http request”] /Common/exercise\_iRule:9: error: [command is not valid in the current scope][}] /Common/exercise\_iRule:11: error: ["invalid argument local0.“Pool”][log local0.“Pool member selected”] /Common/exercise\_iRule:14: error: ["invalid argument local0.“Connection”][log local0.“Connection made with pool member”] /Common/exercise\_iRule:17: error: ["invalid argument local0.“Poolmember”][log local0.“Poolmember made an HTTP response.”]

Are you presenting these errors in irule syntax, need help solving

---

<div class="post-metadata">

**Author:** ![Lee\_Sutcliffe](https://avatars.discourse-cdn.com/v4/letter/l/958977/32.png) [@Lee\_Sutcliffe](https://community.f5.com/u/Lee_Sutcliffe)\
**Post date:** [April 25, 2018, 7:49am UTC](https://community.f5.com/t/problem-with-irules/42463/2 "2018-04-25T07:49:32Z")

</div>

I think it was a formatting issue, please format your iRule like this:

```tcl
when RULE_INIT { 
    log local0."iRule created or updated" 
} 

when CLIENT_ACCEPTED { 
    log local0."in CLIENT_ACCEPTED" 
} 

when HTTP_REQUEST { 
    log local0."Client made an http request" 
} 

when LB_SELECTED { 
    log local0."Pool member selected" 
} 

when SERVER_CONNECTED { 
    log local0."Connection made with pool member" 
} 

when HTTP_RESPONSE { 
    log local0."Pool member made an HTTP response." 
}

```

---

<div class="post-metadata">

**Author:** ![youssef1](https://avatars.discourse-cdn.com/v4/letter/y/ed655f/32.png) [@youssef1](https://community.f5.com/u/youssef1)\
**Post date:** [April 25, 2018, 8:11am UTC](https://community.f5.com/t/problem-with-irules/42463/3 "2018-04-25T08:11:48Z")

</div>

Hello,

try this (it’s important to put a space between “local0.” and your logs. otherwise you will have an error when creating the irule). MrPlactick is right is just a formating issue but additional you have to put a space between “local0.” and your logs…

Like this: log local0. “blablabla”

```tcl
when RULE_INIT { 
    log local0. "iRule created or updated"
}

when CLIENT_ACCEPTED { 
    log local0. "in CLIENT_ACCEPTED"
}

when HTTP_REQUEST { 
    log local0. "Client made an http request"
}

when LB_SELECTED { 
    log local0. "Pool member selected"
}

when SERVER_CONNECTED { 
    log local0. "Connection made with pool member"
}

when HTTP_RESPONSE { 
    log local0. "Pool member made an HTTP response."
}

```

Regards
