5 comments

  • WD-421 hour ago
    This is neat but the examples comparing the tool against piping grep seem to counter the argument to me. A couple of pipes to grep seems much easier to remember and type, especially with all the quotes needed for psc. For scripts where you need exact output this looks great.
    • pstoll53 minutes ago
      I’m the opposite - I much prefer a structured query language (ahem) for this type of thing. If I’m looking at someone’s (ie my own 6 months later) script I much prefer to see the explicit structure being queried vs “why are we feeling for foo or grabbing the 5th field based on squashed spaces as the separater”.<p>Nice use of CEL too. Neat all around.
  • mgaunard52 minutes ago
    I&#x27;m not convinced with the need to embed CEL. You could just output json and pipe to jq.
  • mrbluecoat1 hour ago
    Thanks for including so many examples! Perhaps include one example output. Other than mention of the optional &#x27;--tree&#x27; parameter, it&#x27;s unclear if the default result would be a list, table, JSON, etc.
  • apopapo1 hour ago
    &gt; psc uses eBPF iterators to read process and file descriptor information directly from kernel data structures. This bypasses the &#x2F;proc filesystem entirely, providing visibility that cannot be subverted by userland rootkits or LD_PRELOAD tricks.<p>Is there a trade off here?
    • mgaunard42 minutes ago
      I found this justification dubious. To me the main reason to use eBPF is that it gives more information and is lower overhead.
    • tempay1 hour ago
      It requires root
      • mgaunard51 minutes ago
        Running eBPF programs doesn&#x27;t strictly require root.
  • foobarqux23 minutes ago
    Their first example is bad:<p><pre><code> ps aux | grep nginx | grep root | grep -v grep </code></pre> can be done instead (from memory, not at a Linux machine ATM):<p><pre><code> ps -u root -C nginx </code></pre> which is arguably better than their solution:<p><pre><code> psc &#x27;process.name == &quot;nginx&quot; &amp;&amp; process.user == &quot;root&quot;&#x27;</code></pre>
    • xorcist7 minutes ago
      The commands in their example are not equivalent. The ps | grep thing searches the full command line including argument while ps -C (and, presumably, the psc thing) just returns the process name.<p>Should you for some reason want to do the former, this is easiest done using:<p><pre><code> pgrep -u root -f nginx </code></pre> which exists on almost all platforms, with the notable exception of AIX.<p>Their other slightly convoluted example is:<p><pre><code> psc &#x27;socket.state == established &amp;&amp; socket.dstPort == uint(443)&#x27; </code></pre> which is much more succinct with:<p><pre><code> lsof -i :443 -s TCP:ESTABLISHED</code></pre>