[bug?] doveadm -f json who output
Hi,
I'm trying to parse the output of doveadm -f json who
[0] and am running into a small issue when it returns data about multiple users: the stream that is emitted in that case is not valid json.
dovecot -version tells me dovecot 2.3.21 (47349e2482), more specifically, this is the version shipped in ubuntu 24.04, 1:2.3.21+dfsg1-2ubuntu5
doveadm -f json who [{"username":"<REDACTED>","connections":"4","service":"imap","pids":"(272307 270876 270872 270869)","ips":"(2001:<REDACTED>:7488)"}],{"username":"<REDACTED>","connections":"2","service":"imap","pids":"(271469 271465)","ips":"(2a02:<REDACTED>:9c28)"}
When trying to pretty print this with jq, it complains about invalid json:
doveadm -f json who|jq [ { "username": "<REDACTED>", "connections": "4", "service": "imap", "pids": "(272307 270876 270872 270869)", "ips": "(2001:<REDACTED>0:7488)" } ] jq: parse error: Expected value before ',' at line 1, column 167
Is this expected behaviour? I would have expected a list of user objects, and then it seems like the list-closing bracket that is currently at the end of the first user object should have been at the end of the last user object. I can code around this in my parser, but would rather not.
Best, Jasper
[0] actually I'm parsing the output of the doveadm http api, but that just seems to copy the data from the json format in there verbatim
Hi!
Seems like this is a bug, we'll take a look. Thank you for reporting it.
Aki
On 14/08/2024 19:00 EEST Jasper Spaans via dovecot <dovecot@dovecot.org> wrote:
Hi,
I'm trying to parse the output of
doveadm -f json who
[0] and am running into a small issue when it returns data about multiple users: the stream that is emitted in that case is not valid json.dovecot -version tells me dovecot 2.3.21 (47349e2482), more specifically, this is the version shipped in ubuntu 24.04, 1:2.3.21+dfsg1-2ubuntu5
doveadm -f json who [{"username":"<REDACTED>","connections":"4","service":"imap","pids":"(272307 270876 270872 270869)","ips":"(2001:<REDACTED>:7488)"}],{"username":"<REDACTED>","connections":"2","service":"imap","pids":"(271469 271465)","ips":"(2a02:<REDACTED>:9c28)"}
When trying to pretty print this with jq, it complains about invalid json:
doveadm -f json who|jq [ { "username": "<REDACTED>", "connections": "4", "service": "imap", "pids": "(272307 270876 270872 270869)", "ips": "(2001:<REDACTED>0:7488)" } ] jq: parse error: Expected value before ',' at line 1, column 167
Is this expected behaviour? I would have expected a list of user objects, and then it seems like the list-closing bracket that is currently at the end of the first user object should have been at the end of the last user object. I can code around this in my parser, but would rather not.
Best, Jasper
[0] actually I'm parsing the output of the doveadm http api, but that just seems to copy the data from the json format in there verbatim
dovecot mailing list -- dovecot@dovecot.org To unsubscribe send an email to dovecot-leave@dovecot.org
participants (2)
-
Aki Tuomi
-
Jasper Spaans