Re: Question about LTTng Context

Amir Najafi Zadeh via lttng-dev <[email protected]> Thu, 11 Dec 2025 11:21:35 -0500
Newsgroups org.lttng.lists.lttng-dev
Message-ID <CAOQX81d3NM5YV6gNCCNoA+VAReRu8oe55=vr-TOzBzcRWCHVKQ@mail.gmail.com>
--00000000000096c3360645af8af8
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

I'll try that too. Thanks for mentioning it.

Cheers,
Amir

On Thu, 11 Dec 2025, 11:14 Michael Jeanson, <[email protected]> wrote:

> On 12/11/25 10:51, Amir Najafi Zadeh wrote:
> > Michael, Kienan, Thank you both for your replies. As you mentioned the
> > cgroup namespace, it isn=E2=80=99t very helpful in some cases. Containe=
rs may
> > share the same cgroup namespace, and the container runtime often avoids
> > giving each container a private cgroup namespace for performance and
> > security reasons. Because of this, the cgroup namespace can=E2=80=99t b=
e used as
> > a reliable or unique label for filtering trace logs.
> >
> > In my case, with container-d you can inspect a container, find its PID,
> > and then check /proc/<pid>/ns/cgroup, but you=E2=80=99ll see that diffe=
rent
> > containers often have the same cgroup namespace ID (e.g., in the
> > following logs you can see the calico-node and kube-proxy containers
> > sharing a cgroup ns).
>
> If you want to track containers, the pid namespace is the one used by
> most container runtimes but I don't know specifically for container-d.
>
> >
> > ```
> > Name: calico-node  CID:
> > b5624afe31b005725f4ba53c7b6fe758f3c09fabf013085231ff8b97588f6ace  PID:
> > 2243  cgroup_ns_inode: 4026531835
> > Name: kube-proxy  CID:
> > 52f3c12def7a680f61a925ac92dd5ebd5eba6cad17d671efbfd1d40db7dff624  PID:
> > 1851  cgroup_ns_inode: 4026531835
> >    >> MATCH FOUND: shares ns with container:
> > b5624afe31b005725f4ba53c7b6fe758f3c09fabf013085231ff8b97588f6ace
> > (calico-node)
> > ```
> >
> > Thanks again for your answers. I hope this feature appears in a future
> > patch.
> >
> > Best,
> > Amir
> >
> > On Thu, Dec 11, 2025 at 9:57=E2=80=AFAM Michael Jeanson <mjeanson@effic=
ios.com
> > <mailto:[email protected]>> wrote:
> >
> >     On 12/11/25 09:30, Kienan Stewart via lttng-dev wrote:
> >      > Hi Amir,
> >      >
> >      > On 12/10/25 9:40 PM, Amir Najafi Zadeh via lttng-dev wrote:
> >      >> Hello everyone,
> >      >>
> >      >> I hope you=E2=80=99re doing well. My name is Amir, and I=E2=80=
=99m a PhD student
> in
> >      >> the Computer Science department at Stony Brook University, New
> York.
> >      >>
> >      >> I have a question about the LTTng context that I haven=E2=80=99=
t been
> >     able to
> >      >> find an answer for in the docs or man pages. Does LTTng support
> >     adding
> >      >> the cgroup ID or cgroup path as a context field? I want to
> >     filter my
> >      >> trace results based on cgroups.
> >      >>
> >      >
> >      > I think you're looking for the `cgroup_ns` context which adds th=
e
> >     inum
> >      > of the cgroup namespace as a context field.
> >
> >     This will give you the ID of the cgroup namespace but we don't have
> >     contexts for cgroups themselves. It's probably something we would
> like
> >     to have but there is no concrete plans on implementing this at the
> >     moment.
> >
> >      >
> >      >> If this isn=E2=80=99t supported, are there any plans to add it =
in future
> >      >> versions, such as 2.14?
> >      >>
> >      >> For reference, I=E2=80=99m currently using LTTng 2.13 on Ubuntu=
 24.04
> with
> >      >> kernel 6.8.0-87-generic.
> >      >>
> >      >> Cheers,
> >      >> Amir
> >      >> --
> >      >> *Amirhossein Najafizadeh*
> >      >> *PhD Student, Computer Science Department, Stony Brook
> >     University, N.Y.
> >      >> File systems and Storage Lab (FSL)
> >
>
>

--00000000000096c3360645af8af8
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto">I&#39;ll try that too. Thanks for mentioning it.<div dir=
=3D"auto"><br></div><div dir=3D"auto">Cheers,</div><div dir=3D"auto">Amir</=
div></div><br><div class=3D"gmail_quote gmail_quote_container"><div dir=3D"=
ltr" class=3D"gmail_attr">On Thu, 11 Dec 2025, 11:14 Michael Jeanson, &lt;<=
a href=3D"mailto:[email protected]">[email protected]</a>&gt; wrote=
:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;bor=
der-left:1px #ccc solid;padding-left:1ex">On 12/11/25 10:51, Amir Najafi Za=
deh wrote:<br>
&gt; Michael, Kienan, Thank you both for your replies. As you mentioned the=
 <br>
&gt; cgroup namespace, it isn=E2=80=99t very helpful in some cases. Contain=
ers may <br>
&gt; share the same cgroup namespace, and the container runtime often avoid=
s <br>
&gt; giving each container a private cgroup namespace for performance and <=
br>
&gt; security reasons. Because of this, the cgroup namespace can=E2=80=99t =
be used as <br>
&gt; a reliable or unique label for filtering trace logs.<br>
&gt; <br>
&gt; In my case, with container-d you can inspect a container, find its PID=
, <br>
&gt; and then check /proc/&lt;pid&gt;/ns/cgroup, but you=E2=80=99ll see tha=
t different <br>
&gt; containers often have the same cgroup namespace ID (e.g., in the <br>
&gt; following logs you can see the calico-node and kube-proxy containers <=
br>
&gt; sharing a cgroup ns).<br>
<br>
If you want to track containers, the pid namespace is the one used by <br>
most container runtimes but I don&#39;t know specifically for container-d.<=
br>
<br>
&gt; <br>
&gt; ```<br>
&gt; Name: calico-node =C2=A0CID: <br>
&gt; b5624afe31b005725f4ba53c7b6fe758f3c09fabf013085231ff8b97588f6ace =C2=
=A0PID: <br>
&gt; 2243 =C2=A0cgroup_ns_inode: 4026531835<br>
&gt; Name: kube-proxy =C2=A0CID: <br>
&gt; 52f3c12def7a680f61a925ac92dd5ebd5eba6cad17d671efbfd1d40db7dff624 =C2=
=A0PID: <br>
&gt; 1851 =C2=A0cgroup_ns_inode: 4026531835<br>
&gt;=C2=A0 =C2=A0 &gt;&gt; MATCH FOUND: shares ns with container: <br>
&gt; b5624afe31b005725f4ba53c7b6fe758f3c09fabf013085231ff8b97588f6ace <br>
&gt; (calico-node)<br>
&gt; ```<br>
&gt; <br>
&gt; Thanks again for your answers. I hope this feature appears in a future=
 <br>
&gt; patch.<br>
&gt; <br>
&gt; Best,<br>
&gt; Amir<br>
&gt; <br>
&gt; On Thu, Dec 11, 2025 at 9:57=E2=80=AFAM Michael Jeanson &lt;<a href=3D=
"mailto:[email protected]" target=3D"_blank" rel=3D"noreferrer">mjeanso=
[email protected]</a> <br>
&gt; &lt;mailto:<a href=3D"mailto:[email protected]" target=3D"_blank" =
rel=3D"noreferrer">[email protected]</a>&gt;&gt; wrote:<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0On 12/11/25 09:30, Kienan Stewart via lttng-dev wro=
te:<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; Hi Amir,<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; On 12/10/25 9:40 PM, Amir Najafi Zadeh via lt=
tng-dev wrote:<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;&gt; Hello everyone,<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;&gt; I hope you=E2=80=99re doing well. My name=
 is Amir, and I=E2=80=99m a PhD student in<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;&gt; the Computer Science department at Stony =
Brook University, New York.<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;&gt; I have a question about the LTTng context=
 that I haven=E2=80=99t been<br>
&gt;=C2=A0 =C2=A0 =C2=A0able to<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;&gt; find an answer for in the docs or man pag=
es. Does LTTng support<br>
&gt;=C2=A0 =C2=A0 =C2=A0adding<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;&gt; the cgroup ID or cgroup path as a context=
 field? I want to<br>
&gt;=C2=A0 =C2=A0 =C2=A0filter my<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;&gt; trace results based on cgroups.<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; I think you&#39;re looking for the `cgroup_ns=
` context which adds the<br>
&gt;=C2=A0 =C2=A0 =C2=A0inum<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; of the cgroup namespace as a context field.<b=
r>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0This will give you the ID of the cgroup namespace b=
ut we don&#39;t have<br>
&gt;=C2=A0 =C2=A0 =C2=A0contexts for cgroups themselves. It&#39;s probably =
something we would like<br>
&gt;=C2=A0 =C2=A0 =C2=A0to have but there is no concrete plans on implement=
ing this at the<br>
&gt;=C2=A0 =C2=A0 =C2=A0moment.<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;&gt; If this isn=E2=80=99t supported, are ther=
e any plans to add it in future<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;&gt; versions, such as 2.14?<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;&gt; For reference, I=E2=80=99m currently usin=
g LTTng 2.13 on Ubuntu 24.04 with<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;&gt; kernel 6.8.0-87-generic.<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;&gt; Cheers,<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;&gt; Amir<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;&gt; --<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;&gt; *Amirhossein Najafizadeh*<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;&gt; *PhD Student, Computer Science Department=
, Stony Brook<br>
&gt;=C2=A0 =C2=A0 =C2=A0University, N.Y.<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;&gt; File systems and Storage Lab (FSL)<br>
&gt; <br>
<br>
</blockquote></div>

--00000000000096c3360645af8af8--