On Mon, Sep 02, 2024 at 04:08:35PM +0000, Laura Smith via Postfix-users wrote:
> Fair enough. Although the problem with no output is I've not no
> "schema" to go by when coding the JSON parser ?
A "censored" example:
$ postqueue -j | tail -n1 | jq -n 'fromstream(inputs|tostream|[.[0],
(.[1:][]|"foo")])'
{
"queue_name": "foo",
"queue_id": "foo",
"arrival_time": "foo",
"message_size": "foo",
"forced_expire": "foo",
"sender": "foo",
"recipients": [
{
"address": "foo",
"delay_reason": "foo"
},
{
"address": "foo",
"delay_reason": "foo"
},
{
"address": "foo",
"delay_reason": "foo"
}
]
}
> I guess I could RTFS (Read The Fabulous Source) but my C skills are
> non-existent. Reading C code is a bit like hieroglyphics to me.
One might almost think that Postfix has no documentation. :-) I hope you
don't prefer ad-hoc examples to the documented behaviour "contract".
https://www.postfix.org/postqueue.1.html
JSON OBJECT FORMAT
Each JSON object represents one queue file; it is emitted as a single
text line followed by a newline character.
Object members have string values unless indicated otherwise. Programs
should ignore object members that are not listed here; the list of mem-
bers is expected to grow over time.
queue_name
The name of the queue where the message was found. Note that
the contents of the mail queue may change while it is being
listed; some messages may appear more than once, and some mes-
sages may be missed.
queue_id
The queue file name. The queue_id may be reused within a Postfix
instance unless "enable_long_queue_ids = true" and time is mono-
tonic. Even then, the queue_id is not expected to be unique
between different Postfix instances. Management tools that
require a unique name should combine the queue_id with the
myhostname setting of the Postfix instance.
arrival_time
The number of seconds since the start of the UNIX epoch.
message_size
The number of bytes in the message header and body. This number
does not include message envelope information. It is approxi-
mately equal to the number of bytes that would be transmitted
via SMTP including the <CR><LF> line endings.
forced_expire
The message is forced to expire (true or false). See the post-
super(1) options -e or -f.
This feature is available in Postfix 3.5 and later.
sender The envelope sender address.
recipients
An array containing zero or more objects with members:
address
One recipient address.
delay_reason
If present, the reason for delayed delivery. Delayed
recipients may have no delay reason, for example, while
delivery is in progress, or after the system was stopped
before it could record the reason.
--
Viktor.
_______________________________________________
Postfix-users mailing list -- [email protected]
To unsubscribe send an email to [email protected]