From 41eeef9476bc7df182f97ba1668bd259d81e1f0a Mon Sep 17 00:00:00 2001 From: huali027 <44796653+huali027@users.noreply.github.com> Date: Wed, 30 Nov 2022 13:36:01 +0800 Subject: [PATCH] Add nginx error log which is installed from RHSCL (#3616) Signed-off-by: Huanhuan Li (cherry picked from commit 5c84dc2173ef9f4df3bd747ae4e329e535b575f9) --- insights/specs/default.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/insights/specs/default.py b/insights/specs/default.py index 60c01aa8c4..8db853d60a 100644 --- a/insights/specs/default.py +++ b/insights/specs/default.py @@ -13,7 +13,7 @@ from insights.core.context import HostContext from insights.core.spec_factory import RawFileProvider -from insights.core.spec_factory import simple_file, simple_command, glob_file +from insights.core.spec_factory import simple_file, simple_command, glob_file, head from insights.core.spec_factory import first_of, command_with_args from insights.core.spec_factory import foreach_collect, foreach_execute from insights.core.spec_factory import container_collect, container_execute @@ -412,7 +412,13 @@ class DefaultSpecs(Specs): "/opt/rh/nginx*/root/etc/nginx/*.conf", "/opt/rh/nginx*/root/etc/nginx/conf.d/*.conf", "/opt/rh/nginx*/root/etc/nginx/default.d/*.conf", "/etc/opt/rh/rh-nginx*/nginx/*.conf", "/etc/opt/rh/rh-nginx*/nginx/conf.d/*.conf", "/etc/opt/rh/rh-nginx*/nginx/default.d/*.conf" ]) - nginx_error_log = simple_file("/var/log/nginx/error.log") + + nginx_error_log = first_of( + [ + simple_file("/var/log/nginx/error.log"), + head(glob_file("/var/opt/rh/rh-nginx*/log/nginx/error.log")), + ] + ) nginx_ssl_cert_enddate = foreach_execute(ssl_certificate.nginx_ssl_certificate_files, "/usr/bin/openssl x509 -in %s -enddate -noout") nmcli_conn_show = simple_command("/usr/bin/nmcli conn show") nmcli_dev_show = simple_command("/usr/bin/nmcli dev show")