Skip to content

Commit

Permalink
Fix bug with override path in cgroups (#27620) (#27660)
Browse files Browse the repository at this point in the history
* fix bug with override path

* add changelog

(cherry picked from commit f073c45)

Co-authored-by: Alex K <[email protected]>
  • Loading branch information
mergify[bot] and fearful-symmetry authored Aug 31, 2021
1 parent 6aaabf5 commit c383b2b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Improve `perfmon` metricset performance. {pull}26886[26886]
- Preserve annotations in a kubernetes namespace metadata {pull}27045[27045]
- Allow conditional processing in `decode_xml` and `decode_xml_wineventlog`. {pull}27159[27159]
- Fix build constraint that caused issues with doc builds. {pull}27381[27381]
- Do not try to load ILM policy if `check_exists` is `false`. {pull}27508[27508] {issue}26322[26322]
- Fix bug with cgroups hierarchy override path in cgroups {pull}27620[27620]
- Beat `setup kibana` command may use the elasticsearch API key defined in `output.elasticsearch.api_key`. {issue}24015[24015] {pull}27540[27540]

*Auditbeat*

Expand Down
4 changes: 2 additions & 2 deletions libbeat/metric/system/cgroup/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ func (r *Reader) GetV1StatsForProcess(pid int) (*StatsV1, error) {
stats.Path, stats.ID = getCommonCgroupMetadata(paths)
stats.Version = CgroupsV1
for conName, cgPath := range paths {
if r.ignoreRootCgroups && cgPath.ControllerPath == "/" {
if r.ignoreRootCgroups && (cgPath.ControllerPath == "/" && r.cgroupsHierarchyOverride != cgPath.ControllerPath) {
continue
}
err := getStatsV1(cgPath, conName, &stats)
Expand All @@ -212,7 +212,7 @@ func (r *Reader) GetV2StatsForProcess(pid int) (*StatsV2, error) {
stats.Path, stats.ID = getCommonCgroupMetadata(paths)
stats.Version = CgroupsV2
for conName, cgPath := range paths {
if r.ignoreRootCgroups && cgPath.ControllerPath == "/" {
if r.ignoreRootCgroups && (cgPath.ControllerPath == "/" && r.cgroupsHierarchyOverride != cgPath.ControllerPath) {
continue
}
err := getStatsV2(cgPath, conName, &stats)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ func (p gosigarCidProvider) getProcessCgroups(pid int) (map[string]cgroup.Contro
// ID is found then an empty string is returned.
// Example:
// /kubepods/besteffort/pod9b9e44c2-00fd-11ea-95e9-080027421ddf/2bb9fd4de339e5d4f094e78bb87636004acfe53f5668104addc761fe4a93588e
// V2 Example:
// /kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod1f306eaea646903787fd7cc4eb6be515.slice/crio-eac98011dea91157038ca797f2141754106e074b7242721c7170a642a2204a54.scope
func (p gosigarCidProvider) getCid(cgroups map[string]cgroup.ControllerPath) string {
// if regex defined use it to find cid
if len(p.cgroupRegex) != 0 {
Expand Down

0 comments on commit c383b2b

Please sign in to comment.