# Find processes connected to a specific port
psc 'socket.dstPort == uint(443)'
# Filter by PID range
psc 'process.pid > 1000 && process.pid < 2000'
It seems weird to require the user to remember that ports have to be marked uint when it doesn't look like anything else does.Nice use of CEL too. Neat all around.
Is there a trade off here?
ps aux | grep nginx | grep root | grep -v grep
can be done instead (from memory, not at a Linux machine ATM): ps -u root -C nginx
which is arguably better than their solution: psc 'process.name == "nginx" && process.user == "root"'Should you for some reason want to do the former, this is easiest done using:
pgrep -u root -f nginx
which exists on almost all platforms, with the notable exception of AIX.Their other slightly convoluted example is:
psc 'socket.state == established && socket.dstPort == uint(443)'
which is much more succinct with: lsof -i :443 -s TCP:ESTABLISHED