Azure Monitor REST API를 사용하여 활동 로그 데이터 검색
Azure 활동 로그는 구독의 리소스에서 수행되는 작업에 대한 인사이트를 제공하는 로그입니다. 작업에는 리소스에 대해 수행된 만들기, 업데이트, 삭제 및 기타 작업이 포함됩니다. 활동 로그는 플랫폼 전체 로그이며 특정 서비스로 제한되지 않습니다. 이 문서에서는 Azure Monitor REST API를 사용하여 활동 로그 데이터를 검색하는 방법을 설명합니다. 활동 로그에 대한 자세한 내용은 Azure 활동 로그 이벤트 스키마를 참조하세요.
인증
리소스 로그를 검색하려면 Microsoft Entra를 사용하여 인증해야 합니다. 자세한 내용은 Azure 모니터링 REST API 연습을 참조 하세요.
활동 로그 데이터 검색
Azure Monitor REST API를 사용하여 활동 로그 데이터를 쿼리합니다.
다음 요청 형식은 활동 로그 데이터를 요청하는 데 사용됩니다.
GET /subscriptions/<subscriptionId>/providers/Microsoft.Insights/eventtypes/management/values \
?api-version=2015-04-01 \
&$filter=<filter> \
&$select=<select>
host: management.azure.com
authorization: Bearer <token>
$filter
$filter
는 수집된 데이터 집합을 줄입니다. 이 인수는 필수이며 적어도 시작 날짜/시간도 필요합니다.
인수는 $filter
다음 패턴을 허용합니다.
- 리소스 그룹에
$filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceGroupName eq <resourceGroupName>
대한 이벤트를 나열합니다. - 특정 리소스
$filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceUri eq <resourceURI>
에 대한 이벤트를 나열합니다. - 구독에 대한 이벤트를 시간 범위로 나열합니다
$filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z'
. - 리소스 공급자
$filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and resourceProvider eq <resourceProviderName>
에 대한 이벤트를 나열합니다. - 상관 관계 ID에 대한 이벤트를 나열합니다
$filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' and correlationId eq '<correlationID>
.
$select
$select
는 반환된 이벤트에 대해 지정된 속성 목록을 가져옵니다.
인수 $select
는 반환할 속성 이름의 쉼표로 구분된 목록입니다.
유효한 값은 authorization
다음과 status
level
httpRequest
eventTimestamp
operationId
resourceProviderName
resourceGroupName
resourceId
properties
submissionTimestamp
subStatus
claims
description
subscriptionId
correlationId
eventDataId
eventName
operationName
같습니다.
다음 샘플 요청에서는 Azure Monitor REST API를 사용하여 활동 로그를 쿼리합니다.
필터를 사용하여 활동 로그를 가져옵니다.
다음 예제에서는 날짜와 날짜 2023-03-21T20:00:00Z
사이에 리소스 그룹에 MSSupportGroup
대한 활동 로그를 가져옵니다.2023-03-24T20:00:00Z
GET https://management.azure.com/subscriptions/12345678-abcd-98765432-abcdef012345/providers/microsoft.insights/eventtypes/management/values?api-version=2015-04-01&$filter=eventTimestamp ge '2023-03-21T20:00:00Z' and eventTimestamp le '2023-03-24T20:00:00Z' and resourceGroupName eq 'MSSupportGroup'
필터 및 선택을 사용하여 활동 로그를 가져옵니다.
다음 예제에서는 날짜와 날짜 2023-03-21T20:00:00Z
사이에 리소스 그룹에 MSSupportGroup
대한 활동 로그를 가져오고 2023-03-24T20:00:00Z
eventName, operationName, 상태, eventTimestamp, correlationId, submissionTimestamp 및 수준 요소를 반환합니다.
GET https://management.azure.com/subscriptions/12345678-abcd-98765432-abcdef012345/providers/microsoft.insights/eventtypes/management/values?api-version=2015-04-01&$filter=eventTimestamp ge '2023-03-21T20:00:00Z' and eventTimestamp le '2023-03-24T20:00:00Z'and resourceGroupName eq 'MSSupportGroup'&$select=eventName,operationName,status,eventTimestamp,correlationId,submissionTimestamp,level
다음 단계
Azure Monitor 활동 로그 데이터를 스트리밍합니다. Azure 활동 로그 이벤트 스키마.
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기