Icinga config and vars


My question is about vars and split…
With one of my plugins, for an host and its service, I have for this service a service.output like:

500 Details: problem1,problem2,problem3...

I want to retrieve juste “500” and set it a a var_service for notification.
So on my service config I try to use:

var temp = "$service.output$".split("\\ ")
vars.tag = temp[0]

But it doesnt work, all service.output is sent as tag.
I tried to use icinga console to plit with this expression and it seems to work…

I don’t undertand…

If you have any ideas?