diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_cron_logging/ansible/shared.yml b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_cron_logging/ansible/shared.yml new file mode 100644 index 00000000000..4b39d6207d5 --- /dev/null +++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_cron_logging/ansible/shared.yml @@ -0,0 +1,27 @@ +# platform = multi_platform_all +# reboot = false +# strategy = configure +# complexity = low +# disruption = low + +- name: "{{{ rule_title }}} - Search if cron configuration exists" + ansible.builtin.command: 'grep -s "^\s*cron\.\*\s*/var/log/cron$" /etc/rsyslog.conf /etc/rsyslog.d/*.conf' + register: cron_log_config_exists + failed_when: false + +- name: "{{{ rule_title }}} - Ensure the /etc/rsyslog.d directory exists" + ansible.builtin.file: + path: /etc/rsyslog.d + state: directory + +- name: "{{{ rule_title }}} - Add cron log configuration line" + ansible.builtin.lineinfile: + path: /etc/rsyslog.d/cron.conf + line: "cron.* /var/log/cron" + create: true + when: cron_log_config_exists.stdout_lines | length == 0 + +- name: "{{{ rule_title }}} - Restart the rsyslog service now" + ansible.builtin.service: + name: rsyslog + state: restarted diff --git a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_cron_logging/oval/shared.xml b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_cron_logging/oval/shared.xml index 7b118d8d8f1..c2d130a067d 100644 --- a/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_cron_logging/oval/shared.xml +++ b/linux_os/guide/system/logging/ensure_rsyslog_log_file_configuration/rsyslog_cron_logging/oval/shared.xml @@ -11,7 +11,7 @@ test_ref="test_cron_logging_rsyslog_dir" /> - {{% if product == "ol8" %}} + {{% if "ol" in product %}} 1 - {{% if product == "ol8" %}} + {{% if "ol" in product %}}