Microsoft SQL Server
TMA-MSSQL2022-5.1
Ensure 'Maximum number of error log files' is set to greater than or equal to '12'
설명
SQL Server error log files must be protected from loss. The log files must be backed up before they are overwritten. Retaining more error logs helps prevent loss from frequent recycling before backups can occur. The SQL Server error log contains important information about major server events and login attempt information as well.
점검 방법
감사 방식: SQL 쿼리
sqlcmd -b -h -1 -W -Q "SET NOCOUNT ON; DECLARE @n int; EXEC master.sys.xp_instance_regread N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\MSSQLServer', N'NumErrorLogs', @n OUTPUT; SELECT CASE WHEN ISNULL(@n, -1) = -1 OR @n >= 12 THEN 'compliant' ELSE 'noncompliant' END;"- 예상 출력
compliant
조치 방법
조치 방식: 가이드 또는 인프라 패치
Adjust the number of logs to prevent data loss. The default value of 6 may be insufficient for a production environment. Perform either the GUI or T-SQL method shown: GUI Method 1. Open SQL Server Management Studio. 2. Open Object Explorer and connect to the target instance. 3. Navigate to the Management tab in Object Explorer and expand. Right click on the SQL Server Logs file and select Configure 4. Check the Limit the number of error log files before they are recycled 5. Set the Maximum number of error log files to greater than or equal to 12 T-SQL Method Run the following T-SQL to change the number of error log files, replace <NumberGreaterThan11> with your desired number of error log files: EXEC master.sys.xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\MSSQLServer', N'NumErrorLogs', REG_DWORD, <NumberGreaterThan11>;
속성
- 운영 체제
- 모두
- 태그
- loggingmssqlsqlserver-2022
- 참고 자료
- CIS Microsoft SQL Server 2022 Benchmark v1.3.0 - 5.1 Ensure 'Maximum number of error log files' is set to greater than or equal to '12'
이 호스트 점검하기
감사 권한이 있는 시스템에서 실행하세요. 스캔은 읽기 전용입니다.
tmaegis scan --target mssql