Skip to content

Commit

Permalink
Enable SCC access logging if scc_access_logging variable is set (uy…
Browse files Browse the repository at this point in the history
…uni-project#1519)

This server variable will enable the SCC access logger in testing deployments.
  • Loading branch information
mtravitzky authored Mar 4, 2024
1 parent aea8a6d commit f4e765e
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 2 deletions.
3 changes: 3 additions & 0 deletions modules/cucumber_testsuite/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ locals {
host_key => lookup(var.host_settings[host_key], "create_first_user", false) if var.host_settings[host_key] != null }
repository_disk_use_cloud_setup = { for host_key in local.hosts :
host_key => lookup(var.host_settings[host_key], "repository_disk_use_cloud_setup", null) if var.host_settings[host_key] != null }
scc_access_logging = { for host_key in local.hosts :
host_key => lookup(var.host_settings[host_key], "scc_access_logging", false) if var.host_settings[host_key] != null }
}

module "server" {
Expand Down Expand Up @@ -94,6 +96,7 @@ module "server" {
additional_repos_only = lookup(local.additional_repos_only, "server", false)
additional_packages = lookup(local.additional_packages, "server", [])
login_timeout = var.login_timeout
scc_access_logging = lookup(local.scc_access_logging, "server", false)

saltapi_tcpdump = var.saltapi_tcpdump
provider_settings = lookup(local.provider_settings_by_host, "server", {})
Expand Down
1 change: 1 addition & 0 deletions modules/server/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ module "server" {
java_salt_debugging = var.java_salt_debugging
skip_changelog_import = var.skip_changelog_import
create_first_user = var.create_first_user
scc_access_logging = var.scc_access_logging
mgr_sync_autologin = var.mgr_sync_autologin
create_sample_channel = var.create_sample_channel
create_sample_activation_key = var.create_sample_activation_key
Expand Down
6 changes: 6 additions & 0 deletions modules/server/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,12 @@ variable "traceback_email" {
default = null
}

variable "scc_access_logging" {
description = "Enable logging for SCC access through taskomatic and tomcat"
type = bool
default = false
}

variable "swap_file_size" {
description = "Swap file size in MiB, or 0 for none"
default = 0
Expand Down
14 changes: 13 additions & 1 deletion salt/server/taskomatic.sls
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% if grains.get('java_debugging') or grains.get('java_hibernate_debugging') %}
{% if grains.get('java_debugging') or grains.get('java_hibernate_debugging') or grains.get('scc_access_logging') %}
include:
- server.rhn
{% endif %}
Expand Down Expand Up @@ -33,6 +33,18 @@ taskomatic_hibernate_debug_log:
- sls: server.rhn
{% endif %}

{% if grains.get('scc_access_logging') %}
taskomatic_scc_access_logging:
file.line:
- name: /usr/share/rhn/classes/log4j2.xml
- content: '<Logger name="com.suse.scc.client.SCCWebClient" level="info" />'
- before: "</Loggers>"
- mode: ensure
- indent: True
- require:
- sls: server.rhn
{% endif %}

taskomatic:
service.running:
- watch:
Expand Down
19 changes: 18 additions & 1 deletion salt/server/tomcat.sls
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% if grains.get('java_debugging') or grains.get('java_salt_debugging') %}
{% if grains.get('java_debugging') or grains.get('java_salt_debugging') or grains.get('scc_access_logging') %}
include:
- server.rhn
{% endif %}
Expand Down Expand Up @@ -32,6 +32,23 @@ salt_server_action_service_debug_log:
- sls: server.rhn
{% endif %}

{% if grains.get('scc_access_logging') %}
{% if '4.3' in grains['product_version'] %}
{% set tomcat_log4j2_xml_path = "/srv/tomcat/webapps/rhn/WEB-INF/classes/log4j2.xml" %}
{% else %}
{% set tomcat_log4j2_xml_path = "/usr/share/susemanager/www/tomcat/webapps/rhn/WEB-INF/classes/log4j2.xml" %}
{% endif %}
tomcat_scc_access_logging:
file.line:
- name: {{ tomcat_log4j2_xml_path }}
- content: '<Logger name="com.suse.scc.client.SCCWebClient" level="info" />'
- before: "</Loggers>"
- mode: ensure
- indent: True
- require:
- sls: server.rhn
{% endif %}

{% if grains.get('login_timeout') %}
extend_tomcat_login_timeout:
file.replace:
Expand Down

0 comments on commit f4e765e

Please sign in to comment.