LTTNG-EVENT-RULE(7)
π LTTNG-EVENT-RULE(7) π
LTTng Manual β the common LTTng event rule specification, and yes bestie, weβre getting into it.
β¨ NAME β¨
lttng-event-rule β Common LTTng event rule specification
π¦ SYNOPSIS π¦
Okay so hereβs how you actually say an event rule on the command line. Pick your flavor, bestie.
To match Linux kernel tracepoint or system call events:
--type=(kernel:tracepoint | kernel:syscall[:entry|:exit|:entry+exit])]
[--name=NAME] [--filter=EXPR]
To match Linux kernel kprobe or user space probe events:
--type=(kernel:kprobe | kernel:uprobe) --location=LOC
[--event-name=EVENTNAME]
To match user space tracepoint events:
--type=user:tracepoint [--name=NAME] [--exclude-name=XNAME]...
[--log-level=(LOGLEVEL | LOGLEVEL.. | ..)] [--filter=EXPR]
To match Java/Python logging events:
--type=(jul | log4j | log4j2 | python):logging [--name=NAME]
[--log-level=(LOGLEVEL | LOGLEVEL.. | ..)] [--filter=EXPR]
πΈ DESCRIPTION πΈ
This manual page shows how to specify an LTTng event rule on the command line.
As of LTTng 2.15.1, the command-line options documented here only apply to the event-rule-matches trigger condition specifier (see lttng-add-trigger(1)).
See lttng-concepts(7) to learn more about instrumentation points, events, and event rules.
Note β This manual page only describes the common event rule options. Thelttng(1)commands which require an event rule specification may accept or require other options and arguments, depending on the context. For example, thelttng-add-trigger(1)command also accepts--captureoptions with theevent-rule-matchestrigger condition.
π Overview of event rule condtions π
For LTTng to emit an event E, E must satisfy all the conditions of an event rule, that is:
- The instrumentation point from which LTTng creates E has a specific type. See the βInstrumentation point type conditionβ section below.
- A pattern matches the name of E while another pattern doesnβt. See the βEvent name conditionβ section below.
- The log level of the instrumentation point from which LTTng creates E is at least as severe as some value, or is exactly some value. See the βInstrumentation point log level conditionβ section below.
- The fields of the payload of E and the current context fields satisfy a filter expression. See the βEvent payload and context filter conditionβ section below.
The dedicated command-line options of most conditions are optional: if you donβt specify the option, the associated condition is always satisfied.
π§ Instrumentation point type condition π§
An event E satisfies the instrumentation point type condition of an event rule if the instrumentation point from which LTTng creates E is, depending on the argument of the --type option:
kernel:tracepointβ An LTTng kernel tracepoint, that is, a statically defined point in the source code of the kernel image or of a kernel module with LTTng kernel tracer macros. List the available Linux kernel tracepoints withlttng list --kernel. Seelttng-list(1)to learn more.kernel:syscall:entry,kernel:syscall:exit,kernel:syscall:entry+exitβ The entry, exit, or entry and exit of a Linux kernel system call. List the available Linux kernel system call instrumentation points withlttng list --kernel --syscall. Seelttng-list(1)to learn more.kernel:kprobeβ A Linux kprobe, that is, a single probe dynamically placed in the compiled kernel code. You must specify the kprobe location with the--locationoption. The payload of a Linux kprobe event is empty.kernel:uprobeβ A Linux user space probe, that is, a single probe dynamically placed at the entry of a compiled user space application/library function through the kernel. LTTng 2.15.1 supports the ELF and SystemTap User-level Statically Defined Tracing (USDT; a DTrace-style marker) probing methods. LTTng only supports USDT probes which are NOT reference-counted. You must specify the user space probe location with the--locationoption. The payload of a Linux user space probe event is empty.user:tracepointβ An LTTng user space tracepoint, that is, a statically defined point in the source code of a C/C++ application/library with LTTng user space tracer macros. List the available user space tracepoints withlttng list --userspace. Seelttng-list(1)to learn more.jul:loggingβ Ajava.util.logginglogging statement. List the availablejava.util.loggingloggers withlttng list --jul. Seelttng-list(1)to learn more.log4j:loggingβ An Apache log4j 1.x logging statement. List the available Apache log4j 1.x loggers withlttng list --log4j. Seelttng-list(1)to learn more.log4j2:loggingβ An Apache Log4j 2 logging statement. List the available Apache Log4j 2 loggers withlttng list --log4j2. Seelttng-list(1)to learn more.python:loggingβ A Python logging statement. List the available Python loggers withlttng list --python. Seelttng-list(1)to learn more.
π Event name condition π
An event E satisfies the event name condition of an event rule ER if the two following statements are true:
- You donβt specify the
--name=NAMEoption or, depending on the instrumentation type condition (see the βInstrumentation point type conditionβ section above) of ER, NAME matches:kernel:tracepoint,user:tracepointThe full name of the tracepoint from which LTTng creates E.
Note that the full name of a user space tracepoint is PROVIDER:NAME, where PROVIDER is the tracepoint provider name and NAME is the tracepoint name.
jul:logging,log4j:logging,log4j2:logging,python:loggingThe name of the Java or Python logger from which LTTng creates E.kernel:syscall:entry,kernel:syscall:exit,kernel:syscall:entry+exitThe name of the system call, without anysys_prefix, from which LTTng creates E.
- You donβt specify any
--exclude-name=XNAMEoption or none of the XNAME arguments matches the full name of the user space tracepoint from which LTTng creates E.
The --exclude-name option is only available with the --type=user:tracepoint option.
This condition is only meaningful for the LTTng tracepoint, logging statement, and Linux system call instrumentation point types: itβs always satisfied for the other types.
In all cases, NAME and XNAME are globbing patterns: the * character means βmatch anythingβ. To match a literal * character, use \*.
Important β Make sure to single-quote NAME and XNAME when they contain the*character and when you run anlttng(1)command from a shell.
As of LTTng 2.15.1, not specifying the --name option is equivalent to specifying --name='*Β΄, but this default may change in the future.
π Instrumentation point log level condition π
An event E satisfies the instrumentation point log level condition of an event rule if either:
- You specify the
--log-level=..option or you donβt specify the--log-leveloption.
Defaulting to --log-level=.. when you donβt specify the --log-level option is specific to LTTng 2.15.1 and may change in the future.
- The log level of the LTTng user space tracepoint or logging statement from which LTTng creates E is:
- With the
--log-level=LOGLEVEL..option At least as severe asLOGLEVEL. - With the
--log-level=LOGLEVELoption ExactlyLOGLEVEL.
- With the
As of LTTng 2.15.1, the ..LOGLEVEL and LOGLEVEL..LOGLEVEL formats are NOT supported.
This condition is only meaningful for the LTTng user space tracepoint and logging statement instrumentation point types: itβs always satisfied for other types.
The available values of LOGLEVEL are, depending on the argument of the --type option, from the most to the least severe:
user:tracepoint
EMERG(0)ALERT(1)CRIT(2)ERR(3)WARNING(4)NOTICE(5)INFO(6)DEBUG_SYSTEM(7)DEBUG_PROGRAM(8)DEBUG_PROCESS(9)DEBUG_MODULE(10)DEBUG_UNIT(11)DEBUG_FUNCTION(12)DEBUG_LINE(13)DEBUG(14)
jul:logging
OFF(INT32_MAX)SEVERE(1000)WARNING(900)INFO(800)CONFIG(700)FINE(500)FINER(400)FINEST(300)ALL(INT32_MIN)
log4j:logging
OFF(INT32_MAX)FATAL(50000)ERROR(40000)WARN(30000)INFO(20000)DEBUG(10000)TRACE(5000)ALL(INT32_MIN)
log4j2:logging
OFF(0)FATAL(100)ERROR(200)WARN(300)INFO(400)DEBUG(500)TRACE(600)ALL(INT32_MAX)
python:logging
CRITICAL(50)ERROR(40)WARNING(30)INFO(20)DEBUG(10)NOTSET(0)
π¦ Event payload and context filter condition π¦
An event E satisfies the event payload and context filter condition of an event rule if the --filter=EXPR option is missing or if EXPR is true.
This condition is only meaningful for the LTTng tracepoint and Linux system call instrumentation point types: itβs always satisfied for other types.
EXPR can contain references to the payload fields of E and to the current context fields.
Important β Make sure to single-quote EXPR when you run an lttng(1) command from a shell, as filter expressions typically include characters having a special meaning for most shells.
The expected syntax of EXPR is similar to the syntax of a C language conditional expression (an expression which an if statement can evaluate), but there are a few differences:
- A
NAMEexpression identifies an event payload field named NAME (a C identifier).
Use the C language dot and square bracket notations to access nested structure and array/sequence fields. You can only use a constant, positive integer number within square brackets. If the index is out of bounds, EXPR is false.
The value of an enumeration field is an integer.
When a field expression doesnβt exist, EXPR is false.
Examples: my_field, target_cpu, seq[7], msg.user[1].data[2][17].
- A
$ctx.TYPEexpression identifies the statically-known context field of type TYPE (a C identifier). π«Ά
Wanna see the actual statically-known context field names you can vibe with? Run the lttng-add-context(1) command and it'll spill. Heads up tho: as of LTTng 2.15.1, context field names that start with perf: are not supported, so don't come for me when that one doesn't work. π
When a field expression doesn't exist, EXPR is false. Periodt.
Examples: $ctx.prio, $ctx.gid, $ctx.preemptible.
- A
$app.PROVIDER:TYPEexpression identifies the application-specific context field of type TYPE (a C identifier) from the provider PROVIDER (a C identifier). β¨
When a field expression doesn't exist, EXPR is false. Same energy as above, no notes.
Example: $app.server:cur_user.
- You can compare strings β either string fields or string literals (double-quoted) β with the
==and!=operators. π
When you're comparing to a string literal, the * character means βmatch anythingβ. And if you literally want to match an actual * character? Use \*. Don't forget the backslash, bestie.
Examples: my_field == "user34", my_field == my_other_field, my_field == "192.168.*".
- Here's the whole precedence table of the operators that
EXPRsupports. Highest precedence is1, meaning it grabs first. π- Precedence
1β-β Unary minus β right-to-left - Precedence
1β+β Unary plus β right-to-left - Precedence
1β!β Logical NOT β right-to-left - Precedence
1β~β Bitwise NOT β right-to-left - Precedence
2β<<β Bitwise left shift β left-to-right - Precedence
2β>>β Bitwise right shift β left-to-right - Precedence
3β&β Bitwise AND β left-to-right - Precedence
4β^β Bitwise XOR β left-to-right - Precedence
5β|β Bitwise OR β left-to-right - Precedence
6β<β Less than β left-to-right - Precedence
6β<=β Less than or equal to β left-to-right - Precedence
6β>β Greater than β left-to-right - Precedence
6β>=β Greater than or equal to β left-to-right - Precedence
7β==β Equal to β left-to-right - Precedence
7β!=β Not equal to β left-to-right - Precedence
8β&&β Logical AND β left-to-right - Precedence
9β||β Logical OR β left-to-right
- Precedence
Parentheses are supported so you can bypass the default order whenever you feel like it. π
Important β οΈ Unlike the C language, the bitwise AND and OR operators (&and|) inEXPRtake precedence over the relational operators (<,<=,>,>=,==, and!=). This means the expression2 & 2 == 2is true while the equivalent C expression is false. Yeah. She's different like that. π
The arithmetic operators are NOT supported. Not a thing. Don't ask. π ββοΈ
LTTng first casts all integer constants and fields to signed 64-bit integers. The representation of negative integers is two's complement. Which means that, for example, the signed 8-bit integer field 0xff (-1) becomes 0xffffffffffffffff (still -1) once it's been casted. Math is math. π§
Before a bitwise operator is applied, LTTng casts all its operands to unsigned 64-bit integers, and then casts the result back to a signed 64-bit integer. For the bitwise NOT operator, it's the equivalent of this C expression:
(int64_t) ~((uint64_t) val)
For the binary bitwise operators, it's the equivalent of those C expressions:
(int64_t) ((uint64_t) lhs >> (uint64_t) rhs)
(int64_t) ((uint64_t) lhs << (uint64_t) rhs)
(int64_t) ((uint64_t) lhs & (uint64_t) rhs)
(int64_t) ((uint64_t) lhs ^ (uint64_t) rhs)
(int64_t) ((uint64_t) lhs | (uint64_t) rhs)
If the right-hand side of a bitwise shift operator (<< and >>) is not in the [0, 63] range, then EXPR is false. Stay in your lane, range-wise. π€
EXPR examples:
msg_id == 23 && size >= 2048
$ctx.procname == "lttng*" && (!flag || poel < 34)
$app.my_provider:my_context == 17.34e9 || some_enum >= 14
$ctx.cpu_id == 2 && filename != "*.log"
eax_reg & 0xff7 == 0x240 && x[4] >> 12 <= 0x1234
π Migration from a recording event rule specification π
Since LTTng 2.13, what this manual page documents is the standard, common way to specify an LTTng event rule. It's the moment, honestly. β¨
With the lttng-enable-event(1) command, you also specify an event rule β but with deprecated options and arguments. π So yeah, it works, but it's giving legacy. Use the standard way instead, bestie.
okay so bestie, hereβs the translation cheat sheet from the lttng-enable-event(1) options and arguments over to the common event rule specification options. Itβs giving glow-up but for command-line flags β¨. One mapping at a time, no cap:
- Recording event rule option(s)/argument(s):
--kerneland--tracepointβ Common event rule option(s):--type=kernel:tracepoint - Recording event rule option(s)/argument(s):
--kerneland--syscallβ Common event rule option(s):--type=kernel:syscall:entry+exit - Recording event rule option(s)/argument(s):
--probe=LOCandRECORDNAME(non-option) β Common event rule option(s):--type=kernel:kprobe,--location=LOC, and--event-name=RECORDNAME - Recording event rule option(s)/argument(s):
--userspace-probe=LOCandRECORDNAME(non-option) β Common event rule option(s):--type=kernel:uprobe,--location=LOC, and--event-name=RECORDNAME - Recording event rule option(s)/argument(s):
--function=LOCandRECORDNAME(non-option) β Common event rule option(s): Not available as of LTTng 2.15.1 - Recording event rule option(s)/argument(s):
--userspaceand--tracepointβ Common event rule option(s):--type=user:tracepoint - Recording event rule option(s)/argument(s):
--juland--tracepointβ Common event rule option(s):--type=jul:logging - Recording event rule option(s)/argument(s):
--log4jand--tracepointβ Common event rule option(s):--type=log4j:logging - Recording event rule option(s)/argument(s):
--log4j2and--tracepointβ Common event rule option(s):--type=log4j2:logging - Recording event rule option(s)/argument(s):
--pythonand--tracepointβ Common event rule option(s):--type=python:logging - Recording event rule option(s)/argument(s):
NAME(non-option) β Common event rule option(s):--name=NAME - Recording event rule option(s)/argument(s):
--allβ Common event rule option(s):--name='*Β΄or no--nameoption - Recording event rule option(s)/argument(s):
--exclude=XNAME[,XNAME]...β Common event rule option(s):--exclude-name=XNAMEfor eachXNAME - Recording event rule option(s)/argument(s):
--loglevel=LOGLEVELβ Common event rule option(s):--log-level=LOGLEVEL.. - Recording event rule option(s)/argument(s):
--loglevel-only=LOGLEVELβ Common event rule option(s):--log-level=LOGLEVEL - Recording event rule option(s)/argument(s):
--filter=EXPRβ Common event rule option(s):--filter=EXPR
β¨ Instrumentation point type condition β¨
Sis, go peep the βInstrumentation point type conditionβ section above first, this bit is just the actual flags. π
-E NAME,--event-name=NAMEβ when you're using--type=kernel:kprobeor--type=kernel:uprobe, this sets the name of the events that get emitted to NAME, instead of using theLOCargument from--location=LOC. π«
Defaulting to LOC is a very LTTng 2.15.1 thing and it might change later, so don't get too attached bestie.
-L LOC,--location=LOCβ sets LOC, but what LOC even means depends on your type, okurr? π- With the
--type=kernel:kprobeoption β set the location of the Linux kprobe you wanna insert to LOC.
- With the
LOC is one of:
- An address (the
0xhexadecimal prefix is supported, go off). π’ - A symbol name.
- A symbol name and an offset (in the
SYMBOL+OFFSETformat).
- With the
--type=kernel:uprobeoption β set the location of the user space probe you wanna insert to LOC.
LOC is one of:
[elf:]PATH:SYMBOLβ an available symbol inside a user space application or library.- PATH β the app or library path. It's one of:
- An absolute path.
- A relative path.
- The name of an application as found in the directories listed in the
PATHenvironment variable.
- SYMBOL β the symbol name of the function whose entry you want to instrument.
- PATH β the app or library path. It's one of:
SYMBOL can be any defined code symbol from the output of the nm(1) command, including with its --dynamic option (that one lists dynamic symbols).
As of LTTng 2.15.1, not writing elf: is the same as writing it, but this default may change in the future, so heads up. β οΈ
Examples:
/usr/lib/libc.so.6:malloc./myapp:createUserelf:httpd:ap_run_open_htaccess
sdt:PATH:PROVIDER:NAMEβ a SystemTap User-level Statically Defined Tracing (USDT) probe inside a user space application or library. π§- PATH β the app or library path. This can be:
- An absolute path.
- A relative path.
- The name of an application as found in the directories listed in the
PATHenvironment variable.
- PROVIDER, NAME β the USDT provider and probe names, respectively.
- PATH β the app or library path. This can be:
For example, with this USDT probe:
DTRACE_PROBE2("server", "accept_request",
request_id, ip_addr);
The provider/probe name pair is server:accept_request. π
Example: sdt:./build/server:server:accept_request
-t TYPE,--type=TYPEβ only match events that LTTng creates from an instrumentation point whose type is TYPE. Filtering, but make it fashion. β¨
TYPE is one of:
kernel:tracepointβ an LTTng kernel tracepoint.- As of LTTng 2.15.1,
kernelis an alias, but this may change in the future.
- As of LTTng 2.15.1,
user:tracepointβ an LTTng user space tracepoint.- As of LTTng 2.15.1,
useris an alias, but this may change in the future.
- As of LTTng 2.15.1,
kernel:syscall:entryβ a Linux system call entry.- As of LTTng 2.15.1,
syscall:entryis an alias, but this may change in the future.
- As of LTTng 2.15.1,
kernel:syscall:exitβ a Linux system call exit.- As of LTTng 2.15.1,
syscall:exitis an alias, but this may change in the future.
- As of LTTng 2.15.1,
kernel:syscall:entry+exitβ a Linux system call entry and exit (that's two distinct instrumentation points, not one).- As of LTTng 2.15.1, these are all aliases, but this may change in the future:
syscall:entry+exitkernel:syscallsyscall
- As of LTTng 2.15.1, these are all aliases, but this may change in the future:
kernel:kprobeβ a Linux kprobe.- As of LTTng 2.15.1,
kprobeis an alias, but this may change in the future. - You must specify the location of the kprobe to insert with the
--locationoption. - You may specify the name of the emitted events with the
--event-nameoption.
- As of LTTng 2.15.1,
kernel:uprobeβ a Linux user space probe.- You must specify the location of the user space probe to insert with the
--locationoption. - You may specify the name of the emitted events with the
--event-nameoption.
- You must specify the location of the user space probe to insert with the
jul:loggingβ ajava.util.logginglogging statement.- As of LTTng 2.15.1,
julis an alias, but this may change in the future.
- As of LTTng 2.15.1,
log4j:loggingβ an Apache log4j 1.x logging statement.- As of LTTng 2.15.1,
log4jis an alias, but this may change in the future.
- As of LTTng 2.15.1,
log4j2:loggingβ an Apache Log4j 2 logging statement.- As of LTTng 2.15.1,
log4j2is an alias, but this may change in the future.
- As of LTTng 2.15.1,
python:loggingβ a Python logging statement.- As of LTTng 2.15.1,
pythonis an alias, but this may change in the future.
- As of LTTng 2.15.1,
π Event name condition π
Again bestie, the βEvent name conditionβ section up top has the lore β this is just the flags. π«Ά
-n NAME,--name=NAMEβ only match events where NAME matches, and what "matches" means depends on your--typeargument:kernel:tracepoint,user:tracepointβ the full name of the LTTng tracepoint.jul:logging,log4j:logging,log4j2:logging,python:loggingβ the Java or Python logger name.kernel:syscall:entry,kernel:syscall:exit,kernel:syscall:entry+exitβ the name of the system call, with nosys_prefix.
π¨ This option is NOT available with the other instrumentation point types. Periodt. π«
As of LTTng 2.15.1, not specifying this option is equivalent to specifying --name='*Β΄ (when it applies), but this default may change in the future.
-x XNAME,--exclude-name=XNAMEβ only match events where XNAME does NOT match the full name of the LTTng user space tracepoint. π
Only available with the --type=user:tracepoint option.
NAME and XNAME are globbing patterns: the * character means "match anything". Wanna match a literal * character? Use \*. β
π Instrumentation point log level condition π
Yes, yes β βInstrumentation point log level conditionβ, that section above, mmkay? Here's the flag. π
-l LOGLEVELSPEC,--log-level=LOGLEVELSPECβ only match events where the log level of the LTTng tracepoint or logging statement isβ¦ well, it depends on how LOGLEVELSPEC is formatted:LOGLEVEL..β at least as severe as LOGLEVEL.LOGLEVELβ exactly LOGLEVEL...β literally anything. Vibes only, no filter. π
π« This option is NOT available with the following options: ---type=kernel:tracepoint---type=kernel:syscall:entry---type=kernel:syscall:exit---type=kernel:syscall:entry+exit---type=kernel:kprobe---type=kernel:uprobe
As of LTTng 2.15.1, not specifying this option is equivalent to specifying --log-level=.. (when it applies), but this default may change in the future.
πΈ Event payload and context filter condition πΈ
Last one, and yeah β βEvent payload and context filter conditionβ above, go read it. π
-f EXPR,--filter=EXPRβ only match events where EXPR is true, and EXPR can contain references to event payload and current context fields. π§
This option is only available with the following options: ---type=kernel:tracepoint---type=kernel:syscall:entry---type=kernel:syscall:exit---type=kernel:syscall:entry+exit
π RESOURCES π
- LTTng project website <https://lttng.org>
- LTTng documentation <https://lttng.org/docs>
- LTTng bug tracker <https://bugs.lttng.org>
- Git repositories <https://git.lttng.org>
- GitHub organization <https://github.com/lttng>
- Continuous integration <https://ci.lttng.org/>
- Mailing list <https://lists.lttng.org/> for support and development:
lttng-dev@lists.lttng.org - IRC channel <irc://irc.oftc.net/lttng>:
#lttngonirc.oftc.net - Mastodon <https://mastodon.social/@lttng>
βοΈ COPYRIGHT βοΈ
This program is part of the LTTng-tools project.
LTTng-tools is distributed under the GNU General Public License version 2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html>. See the LICENSE <https://github.com/lttng/lttng-tools/blob/master/LICENSE> file for details.
π«Ά THANKS π«Ά
Special thanks to Michel Dagenais and the DORSAL laboratory <http://www.dorsal.polymtl.ca/> at Γcole Polytechnique de MontrΓ©al for the LTTng journey. π₯Ήπ
Also thanks to the Ericsson teams working on tracing, who helped greatly with detailed bug reports and unusual test cases. Y'all ate, fr fr. π
π SEE ALSO π
lttng(1), lttng-add-trigger(1), lttng-list(1), lttng-concepts(7)
And that's the whole page bestie, we did it!! π This was LTTng 2.15.1, dated 1 April 2025 β iconic, no cap, go trace something pretty. π β¨π¦π
π¦ where this page comes from
- nixpkgs unstable: lttng-tools 2.15.1
- ubuntu stonking: lttng-tools 2.15.1-1 Β· LGPL-2.1-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms