tracing: Expose global views of active filters and triggers
Subsystems (3)
v2 cover tracing: Expose global views of active filters and triggers
Hi Steve,
Currently, auditing active Ftrace event filters or triggers requires userspace to recursively traverse the "events/" directory and read the "filter" or "trigger" file for every individual event. For monitoring tools, security auditors, or developers debugging complex tracing setups, this O(n) traversal is inefficient and cumbersome.
This series introduces two new files at the trace root directory to provide a consolidated, system-wide view of active event configurations:
1. show_event_filters: Displays all events with an active filter
2. show_event_triggers: Displays all events with active triggers
Both files utilise the system:event [tab] config format, allowing for easy parsing by standard tools (e.g., awk) or custom monitoring agents.
The patches leverage the existing trace_event_file iterators to ensure atomic and efficient traversal of the event list. Scope-based RCU protection (guard(rcu)) is used for filter string access, whilst the existing event_mutex protection within the iterator ensures safe traversal of the event trigger lists. For triggers, we utilise the internal cmd_ops->print() callbacks to guarantee that the consolidated output remains consistent with the legacy per-event interface.
Changes since v1 [1]:
- Clarified that all events with filters are listed, regardless of enablement state (Steven Rostedt)
- Optimise filter display logic by utilising the guard(rcu) macro for cleaner scope-based RCU protection and early return (Steven Rostedt)
- Add show_event_triggers to expose event triggers alongside filters (Steven Rostedt)
[1]: https://lore.kernel.org/lkml/[email protected]/
Aaron Tomlin (2):
tracing: Add show_event_filters to expose active event filters
tracing: Add show_event_triggers to expose active event triggers
Documentation/trace/ftrace.rst | 16 +++++ kernel/trace/trace_events.c | 122 +++++++++++++++++++++++++++++++++ 2 files changed, 138 insertions(+)
Signature · 1 line
2.51.0
PATCH v2 1/2 tracing: Add show_event_filters to expose active event filters
Currently, to audit active Ftrace event filters, userspace must recursively traverse the events/ directory and read each individual filter file. This is inefficient for monitoring tools and debugging.
Introduce "show_event_filters" at the trace root directory. This file displays all events that currently have a filter applied, alongside the actual filter string, in a consolidated system:event [tab] filter format.
The implementation reuses the existing trace_event_file iterators to ensure atomic traversal of the event list and utilises guard(rcu)() for automatic, scope-based protection when accessing volatile filter strings.
--- Documentation/trace/ftrace.rst | 8 +++++ kernel/trace/trace_events.c | 58 ++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+)
Documentation/trace/ftrace.rst +8 -0
@@ -684,6 +684,14 @@ of ftrace. Here is a list of some of the key files: See events.rst for more information. + show_event_filters: + + A list of events that have filters. This shows the + system/event pair along with the filter that is attached to + the event. + + See events.rst for more information. + available_events: A list of events that can be enabled in tracing.
kernel/trace/trace_events.c +58 -0
94 lines not on this page · raw message
Signature · 1 line
2.51.0
PATCH v2 2/2 tracing: Add show_event_triggers to expose active event triggers
In reply to Aaron TomlinTo audit active event triggers, userspace currently must traverse the events/ directory and read each individual trigger file. This is cumbersome for system-wide auditing or debugging.
Introduce "show_event_triggers" at the trace root directory. This file displays all events that currently have one or more triggers applied, alongside the trigger configuration, in a consolidated system:event [tab] trigger format.
The implementation leverages the existing trace_event_file iterators and uses the trigger's own print() operation to ensure output consistency with the per-event trigger files.
--- Documentation/trace/ftrace.rst | 8 +++++ kernel/trace/trace_events.c | 64 ++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+)
Documentation/trace/ftrace.rst +8 -0
@@ -692,6 +692,14 @@ of ftrace. Here is a list of some of the key files: See events.rst for more information. + show_event_triggers: + + A list of events that have triggers. This shows the + system/event pair along with the trigger that is attached to + the event. + + See events.rst for more information. + available_events: A list of events that can be enabled in tracing.
kernel/trace/trace_events.c +64 -0
100 lines not on this page · raw message
Signature · 1 line
2.51.0
Randy Dunlap
reviewerRe: [v2 PATCH 2/2] tracing: Add show_event_triggers to expose active event triggers
Hi,
Quoted 6 lines · Aaron Tomlin
Documentation/trace/ftrace.rst +0
-0@@ -692,6 +692,14 @@ of ftrace. Here is a list of some of the key files:
Documentation/trace/ftrace.rst of ftrace. Here is a list of some of the key files: · line 702
Quoted 10 lines
Documentation/trace/ftrace.rst +8
-0See events.rst for more information. + show_event_triggers: + + A list of events that have triggers. This shows the + system/event pair along with the trigger that is attached to + the event. + + See events.rst for more information. +
Isn't this the same chunk that was in patch 1/2?
Quoted 3 lines
Documentation/trace/ftrace.rst +0
-0available_events: A list of events that can be enabled in tracing.
Signature · 1 line
~Randy
Steven Rostedt
maintainerRe: [v2 PATCH 2/2] tracing: Add show_event_triggers to expose active event triggers
Quoted 11 lines · On Mon, 5 Jan 2026 22:10:39 -0800 Randy Dunlap <[email protected]> wrote:
Hi,
Quoted 8 lines · Aaron Tomlin
Documentation/trace/ftrace.rst +0
-0@@ -692,6 +692,14 @@ of ftrace. Here is a list of some of the key files: See events.rst for more information.
Quoted 10 lines
Documentation/trace/ftrace.rst of ftrace. Here is a list of some of the key files: · line 702
Quoted 8 lines
Documentation/trace/ftrace.rst +8
-0+ show_event_triggers: + + A list of events that have triggers. This shows the + system/event pair along with the trigger that is attached to + the event. + + See events.rst for more information. +Isn't this the same chunk that was in patch 1/2?
No, patch 1/2 has:
@@ -684,6 +684,14 @@ of ftrace. Here is a list of some of the key files:
See events.rst for more information.
+ show_event_filters:
+
+ A list of events that have filters. This shows the
+ system/event pair along with the filter that is attached to
+ the event.
+
+ See events.rst for more information.
+
available_events:
It is simply a s/filter/trigger/g difference though.
-- Steve
Randy Dunlap
reviewerRe: [v2 PATCH 2/2] tracing: Add show_event_triggers to expose active event triggers
Quoted 42 lines · Steven Rostedt
Quoted 11 lines · On Mon, 5 Jan 2026 22:10:39 -0800 Randy Dunlap <[email protected]> wrote:
Hi,
Quoted 8 lines · Aaron Tomlin
Documentation/trace/ftrace.rst +0
-0@@ -692,6 +692,14 @@ of ftrace. Here is a list of some of the key files: See events.rst for more information.Quoted 10 lines
Documentation/trace/ftrace.rst of ftrace. Here is a list of some of the key files: · line 702
Quoted 8 lines
Documentation/trace/ftrace.rst +8
-0+ show_event_triggers: + + A list of events that have triggers. This shows the + system/event pair along with the trigger that is attached to + the event. + + See events.rst for more information. +Isn't this the same chunk that was in patch 1/2?
No, patch 1/2 has:
Documentation/trace/ftrace.rst +8
-0@@ -684,6 +684,14 @@ of ftrace. Here is a list of some of the key files: See events.rst for more information. + show_event_filters: + + A list of events that have filters. This shows the + system/event pair along with the filter that is attached to + the event. + + See events.rst for more information. + available_events:
Quoted 1 line
It is simply a s/filter/trigger/g difference though.
Ack. Thanks.
Signature · 1 line
~Randy
Re: [v2 PATCH 2/2] tracing: Add show_event_triggers to expose active event triggers
Quoted 3 lines · Randy Dunlap
Quoted 1 line
It is simply a s/filter/trigger/g difference though.
Ack. Thanks.
Hi Randy,
Sorry about the delay. Indeed, as per Steve.
Kind regards,
Signature · 1 line
Aaron Tomlin