Using busctl to create a log entry

1.4k views Asked by At

Working on openbmc and am trying to create a log entry via busctl. I see that the Create call requires ssa{ss}:

# busctl introspect xyz.openbmc_project.Logging
/xyz/openbmc_project/logging xyz.openbmc_project.Logging.Create      
interface -              -             - .Create                      
method    ssa{ss}        -             -

But, my attempt to make the call fails:

# busctl call xyz.openbmc_project.Logging /xyz/openbmc_project/logging xyz.openbmc_project.Logging.Create Create ssa{ss} 1 "This is a Test" "xyz.openbmc_project.Logging.Entry.Level.Error" "ARG1" "ARG2"
Failed to parse 'xyz.openbmc_project.Logging.Entry.Level.Error' number of array entries: Invalid argument

guessing the issue has to do with formatting of the arguments. Any ideas?

1

There are 1 answers

1
ukBaz On

I don't have openbmc so I can't test this but there are a few things that could be wrong with your statement.

The number after ssa{ss} refers to the length of the array so I think it is in the wrong place. I would expect it to be after the two strings ("This is a Test" and "xyz.openbmc_project.Logging.Entry.Level.Error" in your example)

e.g.

busctl call xyz.openbmc_project.Logging /xyz/openbmc_project/logging xyz.openbmc_project.Logging.Create Create ssa{ss} "This is a Test" "xyz.openbmc_project.Logging.Entry.Level.Error" 1 "ARG1" "ARG2"

I have found what I think is the documentation at https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/xyz/openbmc_project/Logging/Create.interface.yaml#L7

Your example might be clearer if "ARG1" and "ARG2" were "KEY1" and "VALUE1". As I think the following would be true if you had two key/value pairs:

busctl call xyz.openbmc_project.Logging /xyz/openbmc_project/logging xyz.openbmc_project.Logging.Create Create ssa{ss} "This is a Test" "xyz.openbmc_project.Logging.Entry.Level.Error" 2 "KEY1" "VALUE1" "KEY2" "VALUE2"

It always takes me a bit of trial and error to get this correct when using busctl. In another terminal having dbus-monitor running can sometimes be helpful to debug.