Not
Bu sayfaya erişim yetkilendirme gerektiriyor. Oturum açmayı veya dizinleri değiştirmeyi deneyebilirsiniz.
Bu sayfaya erişim yetkilendirme gerektiriyor. Dizinleri değiştirmeyi deneyebilirsiniz.
Bu makalede, Azure İzleyici Aracısı (AMA) ile kullanılmak üzere Veri Toplama Kuralları (DCR) ve DCR İlişkilendirmeleri (DCRA) oluşturmaya yönelik API isteklerine ve yanıtlarına bazı örnekler verilmiştir.
Syslog/CEF
Aşağıdaki örnekler, Syslog ve CEF iletilerini toplamak için AMA kullanan DCR'lere yöneliktir.
Syslog/CEF DCR
Bu örnekler, DCR oluşturmaya yönelik API isteğine ve yanıtına yöneliktir.
Syslog/CEF DCR oluşturma isteği URL'si ve üst bilgisi
Örneğin:
PUT https://management.azure.com/subscriptions/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee/resourceGroups/ContosoRG/providers/Microsoft.Insights/dataCollectionRules/Contoso-DCR-01?api-version=2022-06-01
Syslog/CEF DCR oluşturma isteği gövdesi
Aşağıda bir DCR oluşturma isteği örneği verilmiştir. Her veri kaynağı akışı için bir DCR'de birkaç tane olabilir; bölümünde altına "syslog""dataSources" yeni bir alt bölüm ekleyin ve alanın değerini "streams" almak istediğiniz iletilerin kaynağına göre ayarlayın:
| Günlük kaynağı |
"streams" alan değeri |
|---|---|
| Syslog | "Microsoft-Syslog" |
| CEF | "Microsoft-CommonSecurityLog" |
| Cisco ASA | "Microsoft-CiscoAsa" |
Aşağıdaki kod örneğindeki birden çok akış bölümü örneğine bakın:
{
"location": "centralus",
"kind": "Linux",
"properties": {
"dataSources": {
"syslog": [
{
"name": "localsSyslog",
"streams": [
"Microsoft-Syslog"
],
"facilityNames": [
"auth",
"local0",
"local1",
"local2",
"local3",
"syslog"
],
"logLevels": [
"Critical",
"Alert",
"Emergency"
]
},
{
"name": "authprivSyslog",
"streams": [
"Microsoft-Syslog"
],
"facilityNames": [
"authpriv"
],
"logLevels": [
"Error",
"Alert",
"Critical",
"Emergency"
]
}
]
},
"destinations": {
"logAnalytics": [
{
"workspaceResourceId": "/subscriptions/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee/resourceGroups/ContosoRG/providers/Microsoft.OperationalInsights/workspaces/Contoso",
"workspaceId": "11111111-2222-3333-4444-555555555555",
"name": "DataCollectionEvent"
}
]
},
"dataFlows": [
{
"streams": [
"Microsoft-Syslog"
],
"destinations": [
"DataCollectionEvent"
]
}
]
}
}
Syslog/CEF DCR oluşturma yanıtı
Yukarıdaki örnek isteğe göre almanız gereken yanıt şu şekildedir:
{
"properties": {
"immutableId": "dcr-0123456789abcdef0123456789abcdef",
"dataSources": {
"syslog": [
{
"streams": [
"Microsoft-Syslog"
],
"facilityNames": [
"auth",
"local0",
"local1",
"local2",
"local3",
"syslog"
],
"logLevels": [
"Critical",
"Alert",
"Emergency"
],
"name": "localsSyslog"
},
{
"streams": [
"Microsoft-Syslog"
],
"facilityNames": [
"authpriv"
],
"logLevels": [
"Error",
"Alert",
"Critical",
"Emergency"
],
"name": "authprivSyslog"
}
]
},
"destinations": {
"logAnalytics": [
{
"workspaceResourceId": "/subscriptions/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee/resourceGroups/ContosoRG/providers/Microsoft.OperationalInsights/workspaces/Contoso",
"workspaceId": "11111111-2222-3333-4444-555555555555",
"name": "DataCollectionEvent"
}
]
},
"dataFlows": [
{
"streams": [
"Microsoft-Syslog"
],
"destinations": [
"DataCollectionEvent"
]
}
],
"provisioningState": "Succeeded"
},
"location": "centralus",
"kind": "Linux",
"id": "/subscriptions/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee/resourceGroups/ContosoRG/providers/Microsoft.Insights/dataCollectionRules/Contoso-DCR-01",
"name": "Contoso-DCR-01",
"type": "Microsoft.Insights/dataCollectionRules",
"etag": "\"00000000-0000-0000-0000-000000000000\"",
"systemData": {
}
}
Syslog/CEF DCRA
Syslog/CEF DCRA oluşturma isteği URL'si ve üst bilgisi
PUT
https://management.azure.com/subscriptions/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee/resourceGroups/ContosoRG/providers/Microsoft.Compute/virtualMachines/LogForwarder-VM-1/providers/Microsoft.Insights/dataCollectionRuleAssociations/contoso-dcr-assoc?api-version=2022-06-01
Syslog/CEF DCRA oluşturma isteği gövdesi
{
"properties": {
"dataCollectionRuleId": "/subscriptions/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee/resourceGroups/ContosoRG/providers/Microsoft.Insights/dataCollectionRules/Contoso-DCR-01"
}
}
Syslog/CEF DCRA oluşturma yanıtı
{
"properties": {
"dataCollectionRuleId": "/subscriptions/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee/resourceGroups/ContosoRG/providers/Microsoft.Insights/dataCollectionRules/Contoso-DCR-01"
},
"id": "/subscriptions/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee/resourceGroups/ContosoRG/providers/Microsoft.Compute/virtualMachines/LogForwarder-VM-1/providers/Microsoft.Insights/dataCollectionRuleAssociations/contoso-dcr-assoc",
"name": "contoso-dcr-assoc",
"type": "Microsoft.Insights/dataCollectionRuleAssociations",
"etag": "\"00000000-0000-0000-0000-000000000000\"",
"systemData": {
}
}
Metin dosyalarından özel günlükler
Aşağıdaki örnekler, metin dosyalarından özel günlükleri toplamak için AMA kullanan DCR'lere yöneliktir.
Özel metin günlükleri DCR
Bu örnekler, DCR oluşturmaya yönelik API isteğine yöneliktir.
Özel metin günlükleri DCR oluşturma isteği gövdesi
Aşağıda, özel bir günlük metin dosyası için DCR oluşturma isteği örneği verilmiştir. değerini gerçek değerlerle değiştirin {PLACEHOLDER_VALUES} .
outputStream parametresi yalnızca dönüştürme akışın şemasını değiştirirse gereklidir.
{
"type": "Microsoft.Insights/dataCollectionRules",
"name": "{DCR_NAME}",
"location": "{WORKSPACE_LOCATION}",
"apiVersion": "2022-06-01",
"properties": {
"streamDeclarations": {
"Custom-Text-{TABLE_NAME}": {
"columns": [
{
"name": "TimeGenerated",
"type": "datetime"
},
{
"name": "RawData",
"type": "string"
},
]
}
},
"dataSources": {
"logFiles": [
{
"streams": [
"Custom-Text-{TABLE_NAME}"
],
"filePatterns": [
"{LOCAL_PATH_FILE_1}","{LOCAL_PATH_FILE_2}"
],
"format": "text",
"name": "Custom-Text-{TABLE_NAME}"
}
],
},
"destinations": {
"logAnalytics": [
{
"workspaceResourceId": "{WORKSPACE_RESOURCE_PATH}",
"workspaceId": "{WORKSPACE_ID}",
"name": "DataCollectionEvent"
}
],
},
"dataFlows": [
{
"streams": [
"Custom-Text-{TABLE_NAME}"
],
"destinations": [
"DataCollectionEvent"
],
"transformKql": "source",
"outputStream": "Custom-{TABLE_NAME}"
}
]
}
}
Özel metin günlükleri DCR oluşturma yanıtı
{
"properties": {
"immutableId": "dcr-00112233445566778899aabbccddeeff",
"dataCollectionEndpointId": "/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/Contoso-RG-1/providers/Microsoft.Insights/dataCollectionEndpoints/Microsoft-Sentinel-aaaabbbbccccddddeeeefff",
"streamDeclarations": {
"Custom-Text-ApacheHTTPServer_CL": {
"columns": [
{
"name": "TimeGenerated",
"type": "datetime"
},
{
"name": "RawData",
"type": "string"
}
]
}
},
"dataSources": {
"logFiles": [
{
"streams": [
"Custom-Text-ApacheHTTPServer_CL"
],
"filePatterns": [
"C:\\Server\\bin\\log\\Apache24\\logs\\*.log"
],
"format": "text",
"settings": {
"text": {
"recordStartTimestampFormat": "ISO 8601"
}
},
"name": "Custom-Text-ApacheHTTPServer_CL"
}
]
},
"destinations": {
"logAnalytics": [
{
"workspaceResourceId": "/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/contoso-rg-1/providers/Microsoft.OperationalInsights/workspaces/CyberSOC",
"workspaceId": "cccccccc-3333-4444-5555-dddddddddddd",
"name": "DataCollectionEvent"
}
]
},
"dataFlows": [
{
"streams": [
"Custom-Text-ApacheHTTPServer_CL"
],
"destinations": [
"DataCollectionEvent"
],
"transformKql": "source",
"outputStream": "Custom-ApacheHTTPServer_CL"
}
],
"provisioningState": "Succeeded"
},
"location": "centralus",
"tags": {
"createdBy": "Sentinel"
},
"id": "/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/Contoso-RG-1/providers/Microsoft.Insights/dataCollectionRules/DCR-CustomLogs-01",
"name": "DCR-CustomLogs-01",
"type": "Microsoft.Insights/dataCollectionRules",
"etag": "\"00000000-1111-2222-3333-444444444444\"",
"systemData": {
"createdBy": "gbarnes@contoso.com",
"createdByType": "User",
"createdAt": "2024-08-12T09:29:15.1083961Z",
"lastModifiedBy": "gbarnes@contoso.com",
"lastModifiedByType": "User",
"lastModifiedAt": "2024-08-12T09:29:15.1083961Z"
}
}