Skip to content

Commit fe54be0

Browse files
committed
feat(flags): simplify detectors flag and add short aliases
- Change --detectors to accept paths directly (no yaml-dir= prefix) - Add -d alias for --detectors, -E alias for --enrichment - Simplify config file format to flat list under detectors key - Update --buffers description to 'Set buffers size' - Add detectors man page and update man index with new aliases
1 parent 08b3e03 commit fe54be0

File tree

14 files changed

+175
-86
lines changed

14 files changed

+175
-86
lines changed

cmd/tracee/cmd/man.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ func init() {
5555
capabilitiesCmd,
5656
artifactsCmd,
5757
configCmd,
58+
detectorsCmd,
5859
enrichmentCmd,
5960
eventCmd,
6061
eventsCmd,
@@ -122,9 +123,18 @@ var configCmd = &cobra.Command{
122123
},
123124
}
124125

126+
var detectorsCmd = &cobra.Command{
127+
Use: "detectors",
128+
Aliases: []string{"d"},
129+
Short: "Show manual page for the --detectors flag",
130+
RunE: func(cmd *cobra.Command, args []string) error {
131+
return runManForFlag("detectors")
132+
},
133+
}
134+
125135
var enrichmentCmd = &cobra.Command{
126136
Use: "enrichment",
127-
Aliases: []string{},
137+
Aliases: []string{"E"},
128138
Short: "Show manual page for the --enrichment flag",
129139
RunE: func(cmd *cobra.Command, args []string) error {
130140
return runManForFlag("enrichment")

cmd/tracee/cmd/root.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,9 @@ func initCmd() error {
152152

153153
// Container flags
154154

155-
rootCmd.Flags().StringArray(
155+
rootCmd.Flags().StringArrayP(
156156
flags.EnrichmentFlag,
157+
"E",
157158
[]string{},
158159
"[container|resolve-fd...]\t\tConfigure enrichment for container events and other enrichment features",
159160
)
@@ -190,10 +191,11 @@ func initCmd() error {
190191

191192
// Detector flags
192193

193-
rootCmd.Flags().StringArray(
194+
rootCmd.Flags().StringArrayP(
194195
flags.DetectorsFlag,
196+
"d",
195197
[]string{},
196-
"[yaml-dir=<dir>]\t\t\tConfigure YAML detector search directories",
198+
"[path...]\t\t\t\tConfigure YAML detector search directories",
197199
)
198200
err = viper.BindPFlag(flags.DetectorsFlag, rootCmd.Flags().Lookup(flags.DetectorsFlag))
199201
if err != nil {
@@ -211,7 +213,7 @@ func initCmd() error {
211213
fmt.Sprintf("kernel.artifacts=%d", flags.GetDefaultPerfBufferSize()),
212214
"pipeline=1000",
213215
},
214-
"[kernel.events|...]\t\tSize for kernel and user buffers",
216+
"[kernel.events|...]\t\tSet buffers size",
215217
)
216218
err = viper.BindPFlag(flags.BuffersFlag, rootCmd.Flags().Lookup(flags.BuffersFlag))
217219
if err != nil {

docs/docs/detectors/yaml-detectors.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -910,15 +910,14 @@ Specify custom directories using:
910910

911911
**CLI Flag:**
912912
```bash
913-
tracee --detectors yaml-dir=/custom/path
913+
tracee --detectors /custom/path
914914
```
915915

916916
**Config File:**
917917
```yaml
918918
detectors:
919-
yaml-dir:
920-
- /custom/path1
921-
- /custom/path2
919+
- /custom/path1
920+
- /custom/path2
922921
```
923922

924923
## Validation

docs/docs/flags/buffers.1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ date: 2025/12
77

88
## NAME
99

10-
tracee **\-\-buffers** - Configure the buffers sizes for kernel and user buffers
10+
tracee **\-\-buffers** - Set kernel/user buffers size
1111

1212
## SYNOPSIS
1313

docs/docs/flags/detectors.1.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
title: TRACEE-DETECTORS
3+
section: 1
4+
header: Tracee Detectors Flag Manual
5+
date: 2026/01
6+
...
7+
8+
## NAME
9+
10+
tracee **\-\-detectors** - Configure YAML detector search directories
11+
12+
## SYNOPSIS
13+
14+
tracee **\-\-detectors** [path...] [**\-\-detectors** path...]
15+
16+
## DESCRIPTION
17+
18+
The **\-\-detectors** flag lets you add directories or files to search for YAML detectors and shared lists.
19+
20+
Each path can be a directory or a YAML file. If not specified, Tracee uses the default search path `/etc/tracee/detectors`.
21+
22+
## EXAMPLES
23+
24+
1. Use the default search path:
25+
```console
26+
tracee
27+
```
28+
29+
2. Add a custom directory:
30+
```console
31+
--detectors /custom/detectors
32+
```
33+
34+
3. Add multiple directories:
35+
```console
36+
--detectors /dir1 --detectors /dir2
37+
```
38+
39+
4. Add a specific YAML detector file:
40+
```console
41+
--detectors ./detectors/suspicious_exec.yaml
42+
```
43+
44+
5. Config file format:
45+
```yaml
46+
detectors:
47+
- /custom/path1
48+
- /custom/path2
49+
```

docs/docs/flags/man.1.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ The **man** command accepts subcommands that correspond to tracee flags:
2525
- **buffers** - Show manual page for the --buffers flag
2626
- **capabilities**, **C** - Show manual page for the --capabilities flag
2727
- **config**, **c** - Show manual page for the --config flag
28-
- **enrichment** - Show manual page for the --enrichment flag
28+
- **detectors**, **d** - Show manual page for the --detectors flag
29+
- **enrichment**, **E** - Show manual page for the --enrichment flag
2930
- **events**, **e** - Show manual page for the --events flag
3031
- **list** - Show manual page for the list command
3132
- **list-events** - Show manual page for the list events subcommand

docs/man/buffers.1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
.\"
33
.TH "TRACEE\-BUFFERS" "1" "2025/12" "" "Tracee Buffers Flag Manual"
44
.SS NAME
5-
tracee \f[B]\-\-buffers\f[R] \- Configure the buffers sizes for kernel
6-
and user buffers
5+
tracee \f[B]\-\-buffers\f[R] \- Set kernel/user buffers size
76
.SS SYNOPSIS
8-
tracee \f[B]\-\-buffers\f[R] [kernel.events=<size> | kernel.artifacts=<size>
9-
| kernel.control\-plane=<size> | pipeline=<size>] \&...
7+
tracee \f[B]\-\-buffers\f[R] [kernel.events=<size> |
8+
kernel.artifacts=<size> | kernel.control\-plane=<size> |
9+
pipeline=<size>] \&...
1010
[\f[B]\-\-buffers\f[R] [kernel.events=<size> | kernel.artifacts=<size> |
1111
kernel.control\-plane=<size> | pipeline=<size>] \&...]
1212
.SS DESCRIPTION
@@ -24,8 +24,8 @@ Possible buffer options:
2424
\f[B]kernel.events=<size>\f[R]: Sets the size, in pages, of the internal
2525
perf ring buffer used to submit events from the kernel.
2626
.IP \[bu] 2
27-
\f[B]kernel.artifacts=<size>\f[R]: Sets the size, in pages, of the internal
28-
perf ring buffer used to send artifacts from the kernel.
27+
\f[B]kernel.artifacts=<size>\f[R]: Sets the size, in pages, of the
28+
internal perf ring buffer used to send artifacts from the kernel.
2929
.IP \[bu] 2
3030
\f[B]kernel.control\-plane=<size>\f[R]: Sets the size, in pages, of the
3131
internal perf ring buffer used to submit events from the control plane.

docs/man/detectors.1

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
.\" Automatically generated by Pandoc 3.2
2+
.\"
3+
.TH "TRACEE\-DETECTORS" "1" "2026/01" "" "Tracee Detectors Flag Manual"
4+
.SS NAME
5+
tracee \f[B]\-\-detectors\f[R] \- Configure YAML detector search
6+
directories
7+
.SS SYNOPSIS
8+
tracee \f[B]\-\-detectors\f[R] [path\&...]
9+
[\f[B]\-\-detectors\f[R] path\&...]
10+
.SS DESCRIPTION
11+
The \f[B]\-\-detectors\f[R] flag lets you add directories or files to
12+
search for YAML detectors and shared lists.
13+
.PP
14+
Each path can be a directory or a YAML file.
15+
If not specified, Tracee uses the default search path
16+
\f[CR]/etc/tracee/detectors\f[R].
17+
.SS EXAMPLES
18+
.IP "1." 3
19+
Use the default search path:
20+
.RS 4
21+
.IP
22+
.EX
23+
tracee
24+
.EE
25+
.RE
26+
.IP "2." 3
27+
Add a custom directory:
28+
.RS 4
29+
.IP
30+
.EX
31+
\-\-detectors /custom/detectors
32+
.EE
33+
.RE
34+
.IP "3." 3
35+
Add multiple directories:
36+
.RS 4
37+
.IP
38+
.EX
39+
\-\-detectors /dir1 \-\-detectors /dir2
40+
.EE
41+
.RE
42+
.IP "4." 3
43+
Add a specific YAML detector file:
44+
.RS 4
45+
.IP
46+
.EX
47+
\-\-detectors ./detectors/suspicious_exec.yaml
48+
.EE
49+
.RE
50+
.IP "5." 3
51+
Config file format:
52+
.RS 4
53+
.IP
54+
.EX
55+
detectors\f[B]:\f[R]
56+
\f[B]\-\f[R] /custom/path1
57+
\f[B]\-\f[R] /custom/path2
58+
.EE
59+
.RE

docs/man/man.1

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ flags:
2828
\f[B]config\f[R], \f[B]c\f[R] \- Show manual page for the \[en]config
2929
flag
3030
.IP \[bu] 2
31-
\f[B]enrichment\f[R] \- Show manual page for the \[en]enrichment flag
31+
\f[B]detectors\f[R], \f[B]d\f[R] \- Show manual page for the
32+
\[en]detectors flag
33+
.IP \[bu] 2
34+
\f[B]enrichment\f[R], \f[B]E\f[R] \- Show manual page for the
35+
\[en]enrichment flag
3236
.IP \[bu] 2
3337
\f[B]events\f[R], \f[B]e\f[R] \- Show manual page for the \[en]events
3438
flag

examples/config/global_config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,10 @@ artifacts:
107107
# path: /tmp/tracee
108108
# clear: false
109109

110-
# Detectors configuration
110+
# Detectors configuration - list of paths to search for YAML detectors
111111
detectors:
112-
# yaml-dir:
113-
# - /path/to/detector/dir
112+
# - /path/to/detector/dir
113+
# - /another/detector/path
114114

115115
# Logging configuration
116116
logging:

0 commit comments

Comments
 (0)