You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Pavel Moravec <pm...@redhat.com> on 2014/03/10 10:27:57 UTC
Message auditing in C++ broker
Hi all,
I raised QPID-5619 to implement message auditing in C++ broker. As a new feature with more options of implementation and mainly configuration, I would like to discuss it first. Quoting the JIRA for discussion:
There is a reasonable request to have message enqueue/dequeue audited. It can help troubleshooting or monitoring situations when the broker is suspected from discarding a message that was sent to it but never received by a consumer.
Implementation options as to be discussed in qpid users mailing list:
1) Key feature:
a) where to store/send the information about new message enqueue/dequeue?
- store it in a configurable log-file (per queue? per broker?) - problem with format of binary data there
- amend/modify replicated queues for this purpose - though replicated queues are designed not to replicate messages that are dequeued before they have been replicated
- generate QMF event to be sent to "qmf.default.topic/agent.ind.event.org_apache_qpid_broker.<queue_name>.audit.<enqueue|dequeue>" topic - note this would have to change qpid.subject to route the message properly
- have dedicated audit exchange for this purpose (of topic type, I expect) - again, qpid.subject would have to be changed
b) how to trigger message auditing:
- via QueueObserver (thanks Gordon for idea)
2) Options of auditing:
a) audit enqueue+dequeue events only? or also acquire, release, reject?
b) it should be possible to track only one from enqueue | dequeue | acquire events, or all of them
c) event/message should contain:
- timestamp
- original message (or just its header? or configurable?)
- type of event (enqueue/dequeue/..)
- identification of consumer acquiring/dequeueing the message (and also producer?)
3) Provisioning/managing auditing:
a) have the possibility to turn on/off auditing per queue (via QMF)
b) have some x-declare arguments for the auditing when declaring the queue?
Thanks in advance for your feedback.
Kind regards,
Pavel
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Re: Message auditing in C++ broker
Posted by Andrew Stitcher <as...@redhat.com>.
On Mon, 2014-03-10 at 05:27 -0400, Pavel Moravec wrote:
> Hi all,
> I raised QPID-5619 to implement message auditing in C++ broker. As a new feature with more options of implementation and mainly configuration, I would like to discuss it first. Quoting the JIRA for discussion:
One possible way to implement this would be to add static trace probes
which expose the relevant information at the relevant point in message
or other processing.
These static trace points are compatible between dtrace (Solaris, MacOS
& FreeBSD) and systemtap (Linux) although the qpid build currently only
supports them on Linux (they are compiled a little differently for
dtrace than for systemtap).
This won't in itself give an audit trail. We would also need to write
systemtap scripts to attach to the broker exe and listen for the probes
and produce the audit trail.
I'm not sure if this is an entirely appropriate use of static trace
points but it seems like an interesting possibility especially as they
have almost no overhead when you are not using them, which is a general
problem with audit systems as they need to be inserted in critical
paths.
We currently have some probes in the low level IO subsystem and we could
easily add more in other places to see how useful they might be
elsewhere.
Andrew
>
>
>
> There is a reasonable request to have message enqueue/dequeue audited. It can help troubleshooting or monitoring situations when the broker is suspected from discarding a message that was sent to it but never received by a consumer.
>
> Implementation options as to be discussed in qpid users mailing list:
>
> 1) Key feature:
> a) where to store/send the information about new message enqueue/dequeue?
> - store it in a configurable log-file (per queue? per broker?) - problem with format of binary data there
> - amend/modify replicated queues for this purpose - though replicated queues are designed not to replicate messages that are dequeued before they have been replicated
> - generate QMF event to be sent to "qmf.default.topic/agent.ind.event.org_apache_qpid_broker.<queue_name>.audit.<enqueue|dequeue>" topic - note this would have to change qpid.subject to route the message properly
> - have dedicated audit exchange for this purpose (of topic type, I expect) - again, qpid.subject would have to be changed
>
>
> b) how to trigger message auditing:
> - via QueueObserver (thanks Gordon for idea)
>
>
> 2) Options of auditing:
> a) audit enqueue+dequeue events only? or also acquire, release, reject?
> b) it should be possible to track only one from enqueue | dequeue | acquire events, or all of them
> c) event/message should contain:
> - timestamp
> - original message (or just its header? or configurable?)
> - type of event (enqueue/dequeue/..)
> - identification of consumer acquiring/dequeueing the message (and also producer?)
>
>
> 3) Provisioning/managing auditing:
> a) have the possibility to turn on/off auditing per queue (via QMF)
> b) have some x-declare arguments for the auditing when declaring the queue?
>
>
> Thanks in advance for your feedback.
>
> Kind regards,
> Pavel
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Re: Message auditing in C++ broker
Posted by Fraser Adams <fr...@blueyonder.co.uk>.
I've got nothing much constructive to add to this thread I'm afraid
except to plead:
can any features in this general vein be made extremely switch-off-able?
My primary requirement is for things to be as fast as possible, so
features that might interfere with that make me twitchy.
Basically I can tolerate moderate message loss and I run in memory
non-durable circular queues more or less universally.
In precis I'm fairly agnostic about this feature provided it has zero
impact in message throughput performance.
Frase
On 12/03/14 18:16, Jakub Scholz wrote:
> On Wed, Mar 12, 2014 at 6:30 PM, Gordon Sim <gs...@redhat.com> wrote:
>
>> The journal obviously already records the enqueues and dequeues, it just
>> doesn't keep them around. One option might be to have a modified
>> journal/store that kept the data for longer in some way or moved it into
>> some other repository before removing it from the journals themselves.
>
> Having something like the linear store move the "used" journal files to
> some kind of archive instead of deleting them / reusing them sounds
> similar. The questions is whether the store is flexible enough to contain
> the details like timestamps or some kind of links to connections which
> enqueued / dequeued the messages.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Re: Message auditing in C++ broker
Posted by Jakub Scholz <ja...@scholz.cz>.
On Wed, Mar 12, 2014 at 6:30 PM, Gordon Sim <gs...@redhat.com> wrote:
> The journal obviously already records the enqueues and dequeues, it just
> doesn't keep them around. One option might be to have a modified
> journal/store that kept the data for longer in some way or moved it into
> some other repository before removing it from the journals themselves.
Having something like the linear store move the "used" journal files to
some kind of archive instead of deleting them / reusing them sounds
similar. The questions is whether the store is flexible enough to contain
the details like timestamps or some kind of links to connections which
enqueued / dequeued the messages.
Re: Message auditing in C++ broker
Posted by Gordon Sim <gs...@redhat.com>.
On 03/12/2014 05:10 PM, Jakub Scholz wrote:
>>
>>
>> I assume the audit log doesn't need to be synced in anyway, i.e. if the
>> machine the broker is on has a sudden power failure, its accepted that the
>> activity actually recorded on disk may not be fully up to date?
>>
>>
> Yes, I assume it would be acceptable to lose some minor parts of
> information in case of rare situations like power failure.
The key for some other mechanism for recoding data would be (a) as you
say that it is very fast, even from concurrent threads and (b) can
handle large amounts of data with either manual deletion of old data or
some configuration to hold N days worth whatever.
>> Would the queues being audited generally be durable or might they also be
>> transient? (and what about the persistence of messages)?
>>
>>
> In most cases persistent messages in durable queues. Having the auditing
> for non-persistent messages / non-durable queues might be nice, but not
> 100% necessary. Such messages are unreliable anyway, so when they get lost
> it is not an unexpected event - therefore one might not need an extensive
> audit trail to see all the details about them.
The journal obviously already records the enqueues and dequeues, it just
doesn't keep them around. One option might be to have a modified
journal/store that kept the data for longer in some way or moved it into
some other repository before removing it from the journals themselves.
Might overcomplicate the store, just observing that there is some overlap.
>> Would tcpdump be a possible route? I.e. capture all the AMQP data in and
>> out of the broker, and perhaps then asynchronously process that into a more
>> useful form in a database of some kind?
>>
>>
>>
> I don't think so. Large part of the communication is SSL encrypted - I
> don't think it is possible to decrypt the stream without having the private
> keys from both sides. Or is it? I actually never tried it.
Good point!
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Re: Message auditing in C++ broker
Posted by Jakub Scholz <ja...@scholz.cz>.
>
>
> I assume the audit log doesn't need to be synced in anyway, i.e. if the
> machine the broker is on has a sudden power failure, its accepted that the
> activity actually recorded on disk may not be fully up to date?
>
>
Yes, I assume it would be acceptable to lose some minor parts of
information in case of rare situations like power failure.
> Would the queues being audited generally be durable or might they also be
> transient? (and what about the persistence of messages)?
>
>
In most cases persistent messages in durable queues. Having the auditing
for non-persistent messages / non-durable queues might be nice, but not
100% necessary. Such messages are unreliable anyway, so when they get lost
it is not an unexpected event - therefore one might not need an extensive
audit trail to see all the details about them.
> Would tcpdump be a possible route? I.e. capture all the AMQP data in and
> out of the broker, and perhaps then asynchronously process that into a more
> useful form in a database of some kind?
>
>
>
I don't think so. Large part of the communication is SSL encrypted - I
don't think it is possible to decrypt the stream without having the private
keys from both sides. Or is it? I actually never tried it.
Re: Message auditing in C++ broker
Posted by Gordon Sim <gs...@redhat.com>.
On 03/11/2014 08:33 AM, Jakub Scholz wrote:
> Hi Pavel,
>
> This is definitely a feature I would be interested in :-)
>
> Some time ago, I had a brief look at how such feature could be implemented.
> My ideas were going around the *Observer interfaces (not only
> QueueObserver, but also ConnectionObserver etc.) which seem to be able to
> capture most of the important information, not only message enqueues and
> dequeues. It seemed to me that it might be possible to use the observers to
> receive information about new connections, sessions, queues, messages etc.
>
> I know the original issue was mainly about message enqueue and dequeues,
> but adding information about connections, sessions and queue creation would
> create much more complete picture in the audit file. Although I guess to
> some extent that can be already now captured by the object life cycle
> tracking in the regular log files, which can be probably used to complement
> the message audits.
>
> ad 1a)
> Based on my experience with auditing in our internal software applications,
> I would store the messages in whatever way is considered to be the fastest
> for writing (for example as a structures in a binary file?) and provide
> some tools/API for analysis / parsing of the audit file.
I assume the audit log doesn't need to be synced in anyway, i.e. if the
machine the broker is on has a sudden power failure, its accepted that
the activity actually recorded on disk may not be fully up to date?
Would the queues being audited generally be durable or might they also
be transient? (and what about the persistence of messages)?
> Providing the
> audit information as AMQP stream (in a form of replicated queue or as QMF
> messages) seems like something what would create unnecessary overhead to
> the task. For example in my situation, I probably will not be able to
> analyse the messages in realtime anyway due to security reasons. So I would
> still end up consuming such stream in some client and putting it into a
> file for later analysis. Storing it directly into a file would also avoid
> any problems with modifying parts of the messages.
Would tcpdump be a possible route? I.e. capture all the AMQP data in and
out of the broker, and perhaps then asynchronously process that into a
more useful form in a database of some kind?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Re: Message auditing in C++ broker
Posted by Jakub Scholz <ja...@scholz.cz>.
Hi Pavel,
This is definitely a feature I would be interested in :-)
Some time ago, I had a brief look at how such feature could be implemented.
My ideas were going around the *Observer interfaces (not only
QueueObserver, but also ConnectionObserver etc.) which seem to be able to
capture most of the important information, not only message enqueues and
dequeues. It seemed to me that it might be possible to use the observers to
receive information about new connections, sessions, queues, messages etc.
I know the original issue was mainly about message enqueue and dequeues,
but adding information about connections, sessions and queue creation would
create much more complete picture in the audit file. Although I guess to
some extent that can be already now captured by the object life cycle
tracking in the regular log files, which can be probably used to complement
the message audits.
ad 1a)
Based on my experience with auditing in our internal software applications,
I would store the messages in whatever way is considered to be the fastest
for writing (for example as a structures in a binary file?) and provide
some tools/API for analysis / parsing of the audit file. Providing the
audit information as AMQP stream (in a form of replicated queue or as QMF
messages) seems like something what would create unnecessary overhead to
the task. For example in my situation, I probably will not be able to
analyse the messages in realtime anyway due to security reasons. So I would
still end up consuming such stream in some client and putting it into a
file for later analysis. Storing it directly into a file would also avoid
any problems with modifying parts of the messages.
ad 1b) As mentioned before, I would probably capture everything possible
... connections, sessions, queue creation/deletion, etc. But even only the
message would do :-). It would be also great if we can audit messages
dropped by exchange, but I guess that can be worked around by a small ring
queue and alternate exchange.
ad 2a) Clearly, enqueue and dequeue are the main events, but everything
else might be also of interest. It would be also great if we can capture
delivery in browse mode, where I guess acquire/release is not triggered
explicitely.
ad 2b) If you assign some unique ID to a message in enqueue, the
dequeue/acquire/release/reject probably can contain only a reference to
this ID instead of complete message. That might make auditing of this
additional information quite cheap, so maybe we do not need configuration
for this in such case.
ad 2c) Apart from the obvious timestamp, we also need some sort of link to
the queue where the messages was enqueued/dequeued. The message versus
header might be configurable. In some situation, the header is sufficient
to identify the message content in other source (i.e. producer log) and in
such case it would be unnecessary to store the content. But that doesn't
always apply - therefore configuration would make sense. Also, in my case
the producer/consumer username is not so interesting (as I can in most
cases tell that from the queue name). But a possibility to link the message
to a specific connection/session (especially for consumer) would be great.
ad 3a) For me, that would not be necessary - I would probably have the
auditing switched on all the time.
ad 3b) That is a good question. X-declare might be easily missed at a
temporary queues created by third party entities which forgot to specify
it. Also I'm not sure how easily would x-declare/queue attribute work with
non-Qpid AMQP 1.0 clients. On the other hand, I think there should be some
possibility to say what should be audited and what should not - for example
the QMF messages delivered to some monitoring utilities probably don't need
to be audited. So from that perspective, queue attribute would be useful.
Thanks & Regards
Jakub
On Mon, Mar 10, 2014 at 10:27 AM, Pavel Moravec <pm...@redhat.com> wrote:
> Hi all,
> I raised QPID-5619 to implement message auditing in C++ broker. As a new
> feature with more options of implementation and mainly configuration, I
> would like to discuss it first. Quoting the JIRA for discussion:
>
>
>
> There is a reasonable request to have message enqueue/dequeue audited. It
> can help troubleshooting or monitoring situations when the broker is
> suspected from discarding a message that was sent to it but never received
> by a consumer.
>
> Implementation options as to be discussed in qpid users mailing list:
>
> 1) Key feature:
> a) where to store/send the information about new message enqueue/dequeue?
> - store it in a configurable log-file (per queue? per broker?) - problem
> with format of binary data there
> - amend/modify replicated queues for this purpose - though replicated
> queues are designed not to replicate messages that are dequeued before they
> have been replicated
> - generate QMF event to be sent to
> "qmf.default.topic/agent.ind.event.org_apache_qpid_broker.<queue_name>.audit.<enqueue|dequeue>"
> topic - note this would have to change qpid.subject to route the message
> properly
> - have dedicated audit exchange for this purpose (of topic type, I
> expect) - again, qpid.subject would have to be changed
>
>
> b) how to trigger message auditing:
> - via QueueObserver (thanks Gordon for idea)
>
>
> 2) Options of auditing:
> a) audit enqueue+dequeue events only? or also acquire, release, reject?
> b) it should be possible to track only one from enqueue | dequeue |
> acquire events, or all of them
> c) event/message should contain:
> - timestamp
> - original message (or just its header? or configurable?)
> - type of event (enqueue/dequeue/..)
> - identification of consumer acquiring/dequeueing the message (and also
> producer?)
>
>
> 3) Provisioning/managing auditing:
> a) have the possibility to turn on/off auditing per queue (via QMF)
> b) have some x-declare arguments for the auditing when declaring the queue?
>
>
> Thanks in advance for your feedback.
>
> Kind regards,
> Pavel
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>
>