Rsyslog stops sending messages to /var/log/messages if configured to forward them - rsyslog

Why does Rsyslog stop sending messages to /var/log/messages when I add *.* ##10.0.1.92 to the end of the file?
If I comment that line, it starts sending messages to /var/log/messages again. Thank you.

If I recall correctly, rsyslog uses queues for actions (outputs). If you don't specify a queue, the default queue is used. Each queue is also synchronous; if you don't provide a way to execute actions concurrently, one hanging action (e.g., message forwarding) can block causing the others actions to not be reached.
reference:
https://www.rsyslog.com/doc/v8-stable/concepts/queues.html
https://www.rsyslog.com/doc/v8-stable/rainerscript/queue_parameters.html#example-1
https://www.rsyslog.com/doc/v8-stable/concepts/multi_ruleset.html

Related

How to remove specific message from queue in rabbitmq

I use rabbitmq. I created a queue and put 10 messages here.
I want to delete only specific one of 10 messages here. Is there a way to delete it?
No, there is no way to do that directly. Some alternatives are:
Purge the queue and add back the 9 other messages
Check for that one message on the consumer side and reject/ignore that message
Forward all the messages to another queue, except for that 1 message
The rabbitmq API doesn't seem to support deleting a separate message, but only purging all of them: sudo rabbitmqctl purge_queue <queue name>
However, you can use tricks as written here How to delete a specific message from RabbitMQ Queue?
and here is his package rabbitmq-delete-message if you are comfortable with node.js

How can I delete Messages from a JMS Queue?

I have several jobs that each have multiple messages queued.
The messages for each job are randomly interleaved.
If a user decides to cancel a job I want to remove all the messages that are part of that job from the queue.
I have been able to use browse()to find all the messages to remove but haven't been able to figure out how to remove them.
I tried getting rid of them by using receiveSelected() but it just hangs.
(I am using JmsTemplate)
JMS does not define administration type functions, such as deleting a message from the queue.
The programmatic way is to consume the message. Alternatively, there are messaging management tools that allow you to do this without programming.
There is no any JMS API to remove message. However seems you can invoke purge removeMessage or other operation as per your requirement on MBean org.apache.activemq:type=Broker,brokerName=amq,destinationType=Queue,destinationName=testQ to delete messages.
You are on the right track. Consuming those messages using a selector is the way to go - such as with JmsTemplate receiveSelected.
If it "hangs", it likely means you have no matching messages on the queue. Can you identify your messages on some Property, such as JMSType or other StringProperty? Make sure you can and supply a JMS Selector.
I.e. if your jobs are initiated by user X, then set some property such as "initiatingUser" to "x". Then to consume all messages, use the selector initiatingUser='X'.

Acknowledging prefetched messages using client acknowledge mode

We have a situation in front of us and its explained as below:
We have durable subscriber subscribed to a topic. This durable subscriber is a perl script which is run by a daemon.
The perl script uses stomp to connect to the broker.
The perl script wakes up every 5 mins, checks for messages in the topic and processes them in a batch by pre-fetching the messages.
The subscriber uses a client acknowledgement and acknowledges only the last message of the batch.
We are using AMQ 5.5 with kahaDB persistence.
Now what we see is,
Even though the messages are processed in a batch and the last message is acknowledged the inflight count does not come down.
Enqueue count, Dequeue count and Dispatch count do not match.
The journal files are not getting cleaned up.
I do understand that the journal files would be cleaned up once the references to the messages are lost or removed (i.e. the messages are consumed). But does it have to do anything with the various count attributes I see on the topic?
Also should I expect the inflight count to come down to 0 if client crashes and then consumes all messages after come back live?
Please let me know if there could be any other reason that could cause the journal files to stay back.
Thank you
Hari
Actually I was disconnecting immediately after sending the ack.
Waiting for ack's receipt before disconnecting solved the issue.

How to avoid MQRC2033 NO_MSG_AVAILABLE

I have a simple program to process messages from a queue.
My intention is to process all available messages in queue and still listen to queue for incoming messages.
I have written the processing part inside a infinite loop as i want it to listen to queue always and process messages.
Once after processing all messages again it tries to get a message(as it is inside a infinite loop) from the queue and there
is no messages it throws MQRC 2033 NO_MSG_AVAILABLE exception(infact it is correct) and my program exits.
Can someone give an idea to continously listen to this queue and avoid this exception.
When you execute the MQGET API call, there is an option to have the program wait for messages. You can specify a wait time (in milliseconds) or specify to wait forever. Just make sure that if you have the app wait for more than a few seconds, also specify 'Fail if Quiescing'. This allows the queue manager to be stopped cleanly. Without 'Fail if Quiescing' the administrator will need to issue a preemptive shutdown which can cause problems.
There is a section specifically for this question in the Programmer's Guide in the Waiting for Messages chapter. Depending on the language you are writing in ,the actual value to specify is in the Programmer's Reference, the Using Java manual or the Using .Net manual. Each of these will be visible in the navigation panel when you click the link above.

How to check which point is cause of problem with MQ?

I use MQ for send/receive message between my system and other system. Sometime I found that no response message in response queue, yet other system have already put response message into response queue (check from log). So, how to check which point is cause of problem, how to prove message is not arrive to my response queue.
In addition, when message arrive my queue it will be written to log file.
You can view this in real-time using the QStats interface. The MO71 SupportPac is a desktop client that you can configure to connect similar to WebSphere MQ Explorer. One of the options it has is queue statistics. Each time you view the queue stats, WMQ resets them to zero. So the procedure is this:
Start MO71 and browse the queues.
Filter on the one queue of interest.
View the queue stats a couple of times.
You will see them reset to zero.
Now run your test.
View the queue stats again.
If the remote program actually put a message, you will see that the queue now shows one or more messages PUT.
If your program successfully executed a GET of the message, you will see GET counts equal to the number of PUT counts.
If GET and PUT both zero, the remote program never PUT the response message.
There are a few other approaches to this but this is the easiest. The opposite end of the spectrum is SupportPac MA0W which will show you every API call against that queue, or by PID, or whatever. It shows all the options so if a program tries to open the queue with the wrong options (i.e. open a remote queue for input) it shows that. But MA0W is a installed as an exit and requires the QMgr to be bounced so it's a little invasive.

Resources