mirror of
https://github.com/ansible/awx.git
synced 2026-05-17 14:27:42 -02:30
* Adding API_400_ERROR_LOG_FORMAT setting * Adding functional tests for API_400_ERROR_LOG_FORMAT Co-authored-by: nixocio <nixocio@gmail.com>
This commit is contained in:
@@ -32,6 +32,8 @@ SettingsAPI.readCategory.mockResolvedValue({
|
||||
LOG_AGGREGATOR_MAX_DISK_USAGE_GB: 1,
|
||||
LOG_AGGREGATOR_MAX_DISK_USAGE_PATH: '/var/lib/awx',
|
||||
LOG_AGGREGATOR_RSYSLOGD_DEBUG: false,
|
||||
API_400_ERROR_LOG_FORMAT:
|
||||
'status {status_code} received by user {user_name} attempting to access {url_path} from {remote_addr}',
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -42,7 +42,8 @@ function LoggingDetail() {
|
||||
'LOG_AGGREGATOR_TCP_TIMEOUT',
|
||||
'LOG_AGGREGATOR_TYPE',
|
||||
'LOG_AGGREGATOR_USERNAME',
|
||||
'LOG_AGGREGATOR_VERIFY_CERT'
|
||||
'LOG_AGGREGATOR_VERIFY_CERT',
|
||||
'API_400_ERROR_LOG_FORMAT'
|
||||
);
|
||||
|
||||
const mergedData = {};
|
||||
|
||||
@@ -59,6 +59,7 @@ describe('<LoggingDetail />', () => {
|
||||
assertDetail(wrapper, 'Logging Aggregator Protocol', 'https');
|
||||
assertDetail(wrapper, 'TCP Connection Timeout', '5 seconds');
|
||||
assertDetail(wrapper, 'Logging Aggregator Level Threshold', 'INFO');
|
||||
assertDetail(wrapper, 'Log Format For API 4XX Errors', 'Test Log Line');
|
||||
assertDetail(
|
||||
wrapper,
|
||||
'Enable/disable HTTPS certificate verification',
|
||||
|
||||
@@ -8,7 +8,7 @@ import { CardBody } from 'components/Card';
|
||||
import ContentError from 'components/ContentError';
|
||||
import ContentLoading from 'components/ContentLoading';
|
||||
import { FormSubmitError } from 'components/FormField';
|
||||
import { FormColumnLayout } from 'components/FormLayout';
|
||||
import { FormColumnLayout, FormFullWidthLayout } from 'components/FormLayout';
|
||||
import { useSettings } from 'contexts/Settings';
|
||||
import useModal from 'hooks/useModal';
|
||||
import useRequest from 'hooks/useRequest';
|
||||
@@ -71,6 +71,7 @@ function LoggingEdit() {
|
||||
LOG_AGGREGATOR_LOGGERS: formatJson(form.LOG_AGGREGATOR_LOGGERS),
|
||||
LOG_AGGREGATOR_HOST: form.LOG_AGGREGATOR_HOST || null,
|
||||
LOG_AGGREGATOR_TYPE: form.LOG_AGGREGATOR_TYPE || null,
|
||||
API_400_ERROR_LOG_FORMAT: form.API_400_ERROR_LOG_FORMAT || null,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -196,6 +197,12 @@ function LoggingEdit() {
|
||||
name="LOG_AGGREGATOR_LOGGERS"
|
||||
config={logging.LOG_AGGREGATOR_LOGGERS}
|
||||
/>
|
||||
<FormFullWidthLayout>
|
||||
<InputField
|
||||
name="API_400_ERROR_LOG_FORMAT"
|
||||
config={logging.API_400_ERROR_LOG_FORMAT}
|
||||
/>
|
||||
</FormFullWidthLayout>
|
||||
{submitError && <FormSubmitError error={submitError} />}
|
||||
{revertError && <FormSubmitError error={revertError} />}
|
||||
<RevertFormActionGroup
|
||||
|
||||
@@ -34,6 +34,8 @@ const mockSettings = {
|
||||
LOG_AGGREGATOR_MAX_DISK_USAGE_GB: 1,
|
||||
LOG_AGGREGATOR_MAX_DISK_USAGE_PATH: '/var/lib/awx',
|
||||
LOG_AGGREGATOR_RSYSLOGD_DEBUG: false,
|
||||
API_400_ERROR_LOG_FORMAT:
|
||||
'status {status_code} received by user {user_name} attempting to access {url_path} from {remote_addr}',
|
||||
};
|
||||
|
||||
describe('<LoggingEdit />', () => {
|
||||
|
||||
@@ -564,6 +564,15 @@
|
||||
"category_slug": "logging",
|
||||
"default": false
|
||||
},
|
||||
"API_400_ERROR_LOG_FORMAT": {
|
||||
"type": "string",
|
||||
"required": false,
|
||||
"label": "Log Format For API 4XX Errors",
|
||||
"help_text": "The format of logged messages when an API 4XX error occurs, the following variables will be substituted: \nstatus_code - The HTTP status code of the error\nuser_name - The user name attempting to use the API\nurl_path - The URL path to the API endpoint called\nremote_addr - The remote address seen for the user\nerror - The error set by the api endpoint\nVariables need to be in the format {<variable name>}.",
|
||||
"category": "Logging",
|
||||
"category_slug": "logging",
|
||||
"default": "status {status_code} received by user {user_name} attempting to access {url_path} from {remote_addr}"
|
||||
},
|
||||
"AUTOMATION_ANALYTICS_LAST_GATHER": {
|
||||
"type": "datetime",
|
||||
"required": true,
|
||||
@@ -4221,6 +4230,15 @@
|
||||
"category_slug": "logging",
|
||||
"defined_in_file": false
|
||||
},
|
||||
"API_400_ERROR_LOG_FORMAT": {
|
||||
"type": "string",
|
||||
"required": false,
|
||||
"label": "Log Format For API 4XX Errors",
|
||||
"help_text": "The format of logged messages when an API 4XX error occurs, the following variables will be substituted: \nstatus_code - The HTTP status code of the error\nuser_name - The user name attempting to use the API\nurl_path - The URL path to the API endpoint called\nremote_addr - The remote address seen for the user\nerror - The error set by the api endpoint\nVariables need to be in the format {<variable name>}.",
|
||||
"category": "Logging",
|
||||
"category_slug": "logging",
|
||||
"default": "status {status_code} received by user {user_name} attempting to access {url_path} from {remote_addr}"
|
||||
},
|
||||
"AUTOMATION_ANALYTICS_LAST_GATHER": {
|
||||
"type": "datetime",
|
||||
"label": "Last gather date for Insights for Ansible Automation Platform.",
|
||||
@@ -6329,7 +6347,7 @@
|
||||
},
|
||||
"SOCIAL_AUTH_SAML_USER_FLAGS_BY_ATTR": {
|
||||
"type": "nested object",
|
||||
"label": "SAML User Flags Attribute Mapping",
|
||||
"label": "SAML User Flags Attribute Mapping",
|
||||
"help_text": "Used to map super users and system auditors from SAML.",
|
||||
"category": "SAML",
|
||||
"category_slug": "saml",
|
||||
|
||||
@@ -70,6 +70,7 @@
|
||||
"LOG_AGGREGATOR_MAX_DISK_USAGE_GB":1,
|
||||
"LOG_AGGREGATOR_MAX_DISK_USAGE_PATH":"/var/lib/awx",
|
||||
"LOG_AGGREGATOR_RSYSLOGD_DEBUG":false,
|
||||
"API_400_ERROR_LOG_FORMAT":"status {status_code} received by user {user_name} attempting to access {url_path} from {remote_addr}",
|
||||
"AUTOMATION_ANALYTICS_LAST_GATHER":null,
|
||||
"AUTOMATION_ANALYTICS_GATHER_INTERVAL":14400,
|
||||
"SESSION_COOKIE_AGE":1800,
|
||||
|
||||
@@ -17,5 +17,6 @@
|
||||
"LOG_AGGREGATOR_LEVEL": "INFO",
|
||||
"LOG_AGGREGATOR_MAX_DISK_USAGE_GB": 1,
|
||||
"LOG_AGGREGATOR_MAX_DISK_USAGE_PATH": "/var/lib/awx",
|
||||
"LOG_AGGREGATOR_RSYSLOGD_DEBUG": false
|
||||
}
|
||||
"LOG_AGGREGATOR_RSYSLOGD_DEBUG": false,
|
||||
"API_400_ERROR_LOG_FORMAT": "Test Log Line"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user