Skip to content

Commit

Permalink
docs: Add an example on how to use cgroup path
Browse files Browse the repository at this point in the history
Disable cgroup_path meta data by default
  • Loading branch information
mahendrapaipuri committed Dec 3, 2024
1 parent 1302357 commit 7a9e449
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
28 changes: 28 additions & 0 deletions docs/sources/reference/components/discovery/discovery.process.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,34 @@ discovery.process "all" {
}
}
### Example discovering processes on the local host based on `cgroups` path
To discover processes running under systemd services on the local host.
```alloy
discovery.process "all" {
refresh_interval = "60s"
discover_config {
cwd = true
exe = true
commandline = true
username = true
uid = true
cgroup_path = true
container_id = true
}
}
discovery.relabel "systemd_services" {
targets = discovery.process.all.targets
// Only keep the targets that correspond to systemd services
rule {
action = "keep"
regex = "^.*/([a-zA-Z0-9-_]+).service(?:.*$)"
source_labels = ["__meta_cgroup_id"]
}
}
```
<!-- START GENERATED COMPATIBLE COMPONENTS -->

Expand Down
2 changes: 1 addition & 1 deletion internal/component/discovery/process/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var DefaultConfig = Arguments{
Exe: true,
Commandline: true,
ContainerID: true,
CgroupPath: true,
CgroupPath: false,
},
}

Expand Down

0 comments on commit 7a9e449

Please sign in to comment.