Skip to content

Commit d746853

Browse files
obaranovgerritforge-ltd
authored andcommitted
Merge "Collect logs: aggregate selinux denial patterns"
2 parents 55c3594 + 38bb529 commit d746853

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

plugins/collect-logs/main.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
- name: "initialize temp variables"
3636
set_fact:
3737
selinux_problems: 0
38+
# use list to convert selinux avc denials from all nodes into list of unique patterns from all of them together
39+
selinux_problems_list: []
3840
segfault_problems: 0
3941
oom_killer_problems: 0
4042
counted_hosts: "{{ groups['all'] | difference( groups['local'] + (groups['tester'] | default([]) | difference(groups['controller']|default([]))) ) }}"
@@ -44,7 +46,8 @@
4446

4547
- name: "add together all issue counts from all hosts except localhost and tester"
4648
set_fact:
47-
selinux_problems: "{{ selinux_problems | int + ( hostvars[item]['selinux_problems_found'] | default([]) | length ) }}"
49+
selinux_problems_list: "{{ selinux_problems_list + (hostvars[item]['selinux_problems_found'] | default([])) }}"
50+
selinux_problems: "{{ selinux_problems_list | length }}"
4851
segfault_problems: "{{ segfault_problems | int + ( hostvars[item]['segfault_problems_found'] | default([]) | length ) }}"
4952
oom_killer_problems: "{{ oom_killer_problems | int + ( hostvars[item]['oom_killer_problems_found'] | default([]) | length ) }}"
5053
with_items: "{{ counted_hosts }}"

plugins/collect-logs/tasks/collect_host_logs.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@
181181

182182
- name: Search for AVC denied
183183
become: yes
184-
shell: "! grep -i denied /var/log/audit/audit*"
184+
# sed used to replace numeric runtime/instance values, to reduce list of occurencies to their patterns
185+
shell: "! (grep -i denied /var/log/audit/* | sed -r 's/audit\\(.*\\): avc/audit(...): avc/; s/(pid|ino)=[0-9]+ /\\1=... /g'|sort -u)"
185186
register: result
186187
ignore_errors: yes
187188

0 commit comments

Comments
 (0)