TransWikia.com

How I can continuously log processes connected to a socket

Server Fault Asked by mapedraza on February 15, 2021

I have a project with an architecture based on a RabbitMQ queue. Each day at 00:30 triggered by a CRON job, the producer process gets the information from a web page and writes in the queue in order to send the information to the consumer process which is subscribed to the queue.

It works fine, but, randomly I get a message in the queue around 2 hours later(It is not fixed, can be at 03.16 or at 03:44). I activated the log with RabbitMQ but I am not able to see which processes are opening that TCP socket. So I would like to log all processes that open a socket on the listening port (the queue) in order to see which process is writing randomly the queue.

One Answer

You can use the command lsof, which is used to figure out what processes are opening what files. In your case you could use

lsof -i TCP:22

which will give you the command, pid, and the user accessing the socket along with a few other things.

Answered by sapphireYETi on February 15, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP