In a cli script I want to add a handler to the root-logger, if it doesn't already exist. The handlers attribute is of type LIST:
[standalone@localhost:9990 root-logger=ROOT] ls -l
ATTRIBUTE VALUE TYPE
filter undefined OBJECT
filter-spec undefined STRING
handlers ["CONSOLE","FILE"] LIST
level INFO STRING
[standalone@localhost:9990 root-logger=ROOT] /subsystem=logging/root-logger=ROOT:read-attribute(name=handlers)
{
"outcome" => "success",
"result" => [
"CONSOLE",
"FILE"
]
}
I want to add a LOGSTASH handler, tried various variants like e.g. this:
if ( result.value != LOGSTASH-ASYNC ) of /subsystem=logging/root-logger=ROOT:read-attribute(name=handlers)
/subsystem=logging/root-logger=ROOT:add-handler(name=LOGSTASH-ASYNC)
end-if
but no luck. So, my question is how can I test if handlers list already contains LOGSTASH-ASYNC?