Logging unix connections

A few days ago I had a problem with my server.
The asterisk was running at 100% CPU, and when I tried to open the asterisk CLI I got a message that there are too many active connections.
the command: netstat -anp | grep ast
gave an output of 128 lines of UNIX connections (checked with wc -l)
the full log only shows when there are incoming connections (logger.c: – Remote UNIX connection)
or when a connection is disconnected.
How can I log which process is starting the connection?

These will be from asterisk -r, the CLI thread of asterisk -c, or rasterisk (an alias for asterisk -r), so ps | grep asterisk is the easy way to find them.

You should also be able to find them by lsof on the .ctl pipe. netstat -p may also give some clues.