How can I read log via the api?

How to run a command in the api?
log print where message~“logged” (it works in ssh)

This design does not work:
/log/print
=where=
=message=~“logged”

After execution I get - !trap=message=unknown parameter