Identity Server 로그 정리
Sitecore 9.3 Identity Server에 대한 로그를 정리하는 방법이 있습니까?
로깅 구성을 검색했지만 아무것도 찾지 못했습니다. 10 일이 지난 로그를 자동으로 삭제하도록 구성을 업데이트하고 싶습니다.
답변
Identity Server는 Serilog (https://github.com/serilog/serilog) 로그를 작성하고 단일 파일 싱크가 기본적으로 구성됩니다.
기본적으로 31 개의 파일 (한 달 동안)을 보관합니다. 10 일 로그 만 유지 retainedFileCountLimit하려면 <IS Siteroot>\sitecorehost.xml아래와 같이 값이 10으로 설정된 인수 를 전달 합니다.
참조 -
- https://doc.sitecore.com/developers/91/sitecore-experience-manager/en/logging.html
- https://github.com/serilog/serilog-sinks-file#limits
Sitecore 수준에서만 수행하려면 <agent type="Sitecore.Tasks.CleanupAgent"CM 웹 사이트의 IdentityServer 로그 폴더에 대한 항목을 추가 할 수 있지만 IIS AppPool 사용자에게 삭제 액세스 권한을 부여해야합니다. 예 :IIS AppPool\CMSiteAppPoolUser
<remove folder="C:\inetpub\wwwroot\sc93identityserver.dev.local\logs" pattern="*.*" maxAge="10.00:00:00"/>
Sitecore 수준에서 수행해서는 안된다고 생각합니다.
예약 된 PowerShell 스크립트로 비슷한 작업을 수행합니다. 귀하의 경우이 Powershell 스크립트가 작업을 수행해야합니다.
$old = 10 $folder = 'your path'
Get-ChildItem $folder | Where-Object {-not $_.PSIsContainer -and $now.Subtract($_.CreationTime).Days -gt $old } | ForEach-Object {Remove-Item $_.FullName -Confirm:$false -Force -Recurse}
그런 다음 온-프레미스 호스팅으로 작업하는 경우 Windows 스케줄러에이 스크립트의 실행을 추가하고 Azure PaaS를 사용하는 경우 WebJobs 를 사용합니다.