diff --git a/packages/azure_ai_foundry/_dev/build/docs/README.md b/packages/azure_ai_foundry/_dev/build/docs/README.md index ab346528634..7b9c16500e9 100644 --- a/packages/azure_ai_foundry/_dev/build/docs/README.md +++ b/packages/azure_ai_foundry/_dev/build/docs/README.md @@ -4,6 +4,37 @@ Azure AI Foundry provides a comprehensive suite of AI services that enable devel ## Data streams +### Logs + +The Azure AI Foundry logs data stream captures the gateway log events. + +These are the supported Azure log categories: + +| Data Stream | Log Category | +|:-----------:|:------------------------:| +| logs | ApiManagementGatewayLogs | + +#### Requirements and setup + +Refer to the [Azure Logs](https://docs.elastic.co/integrations/azure) page for more information on how to set up and use this integration. + +#### API Gateway Logs + +The API Management services provide the advanced logging capabilities. The `ApiManagementGatewayLogs` category comes under the advanced logging. This is not directly available in the Azure AI Foundry service itself. You have to set up the API Management services in Azure to access the Azure AI Foundry models. When the setup is complete, add the diagnostic setting for the API Management service. + +For more information on how to implement the comprehensive solution using API Management services to monitor the Azure AI Foundry services, check the [AI Foundry API](https://learn.microsoft.com/en-us/azure/api-management/azure-ai-foundry-api) page. + +**Diagnostic settings** + +- Enable the category `Logs related to ApiManagement Gateway` to stream the logs to the event hub. + +```text + ┌──────────────────┐ ┌──────────────┐ ┌─────────────────┐ + │ APIM service │ │ Diagnostic │ │ Event Hub │ + │ <> │─────▶│ settings │────▶│ <> │ + └──────────────────┘ └──────────────┘ └─────────────────┘ +``` + ### Metrics The metrics data stream collects the cognitive service metrics that is specific to the Azure AI Foundry service. @@ -40,6 +71,16 @@ If no resource filter is specified, then all Azure AI Foundry services inside th The primary aggregation value will be retrieved for all the metrics contained in the namespaces. The aggregation options are `avg`, `sum`, `min`, `max`, `total`, `count`. +#### Logs Reference + +{{event "logs"}} + +**ECS Field Reference** + +For more details on ECS fields, check the [ECS Field Reference](https://www.elastic.co/guide/en/ecs/current/ecs-field-reference.html) documentation. + +{{fields "logs"}} + #### Metrics Reference The Azure AI Foundry metrics provide insights into the performance and usage of your AI resources. These metrics help in monitoring and optimizing your deployments. diff --git a/packages/azure_ai_foundry/changelog.yml b/packages/azure_ai_foundry/changelog.yml index 7be7c43f8cf..e270bfcd9c2 100644 --- a/packages/azure_ai_foundry/changelog.yml +++ b/packages/azure_ai_foundry/changelog.yml @@ -1,3 +1,8 @@ +- version: "0.2.0" + changes: + - description: Add support for API Management Gateway logs. + type: enhancement + link: https://github.com/elastic/integrations/pull/14346 - version: "0.1.1" changes: - description: Fix overview dashboard visualization labels. diff --git a/packages/azure_ai_foundry/data_stream/logs/_dev/test/pipeline/test-ai-foundry-gateway.log b/packages/azure_ai_foundry/data_stream/logs/_dev/test/pipeline/test-ai-foundry-gateway.log new file mode 100644 index 00000000000..df5a986f1a0 --- /dev/null +++ b/packages/azure_ai_foundry/data_stream/logs/_dev/test/pipeline/test-ai-foundry-gateway.log @@ -0,0 +1,4 @@ +{"DeploymentVersion":"0.44.18652.0","Level":4,"Sku":"Basic","callerIpAddress":"89.160.20.156","category":"GatewayLogs","correlationId":"99789635-18d0-480f-8182-a3a3c477a6a4","durationMs":176,"isRequestSuccess":true,"location":"East US","operationName":"Microsoft.ApiManagement/GatewayLogs","properties":{"apiId":"azure-ai-foundry-apim-api","apiRevision":"1","backendMethod":"POST","backendProtocol":"HTTP/1.1","backendRequestBody":"{\"model\": \"gpt-chat-pilot\", \"messages\": [{\"role\": \"user\", \"content\": \"capital of tamilnadu?\"}]}","backendResponseBody":"{\"choices\":[{\"content_filter_results\":{\"custom_blocklists\":[],\"hate\":{\"filtered\":true,\"severity\":\"low\"},\"profanity\":{\"filtered\":false,\"detected\":false},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}},\"finish_reason\":\"stop\",\"index\":0,\"logprobs\":null,\"message\":{\"content\":\"The capital of Tamil Nadu is Chennai.\",\"role\":\"assistant\"}}],\"created\":1719901891,\"id\":\"chatcmpl-9gRL14hGa8nQstOJKvLjh7EyulsnT\",\"model\":\"gpt-35-turbo\",\"object\":\"chat.completion\",\"prompt_filter_results\":[{\"prompt_index\":0,\"content_filter_results\":{\"custom_blocklists\":[],\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"profanity\":{\"filtered\":false,\"detected\":false},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"system_fingerprint\":null,\"usage\":{\"completion_tokens\":8,\"prompt_tokens\":14,\"total_tokens\":22}}\n","backendResponseCode":200,"backendTime":176,"backendUrl":"https://obs-aifoundry-test-01.aifoundry.azure.com/aifoundry/deployments/gpt-chat-pilot/chat/completions?api-version=2024-02-15-preview","cache":"none","clientProtocol":"HTTP/1.1","clientTlsVersion":"1.3","method":"POST","operationId":"ChatCompletions_Create","requestBody":"{\"model\": \"gpt-chat-pilot\", \"messages\": [{\"role\": \"user\", \"content\": \"capital of tamilnadu?\"}]}","requestSize":536,"responseBody":"{\"choices\":[{\"content_filter_results\":{\"custom_blocklists\":[],\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"profanity\":{\"filtered\":false,\"detected\":false},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}},\"finish_reason\":\"stop\",\"index\":0,\"logprobs\":null,\"message\":{\"content\":\"The capital of Tamil Nadu is Chennai.\",\"role\":\"assistant\"}}],\"created\":1719901891,\"id\":\"chatcmpl-9gRL14hGa8nQstOJKvLjh7EyulsnT\",\"model\":\"gpt-35-turbo\",\"object\":\"chat.completion\",\"prompt_filter_results\":[{\"prompt_index\":0,\"content_filter_results\":{\"custom_blocklists\":[],\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"profanity\":{\"filtered\":false,\"detected\":false},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}],\"system_fingerprint\":null,\"usage\":{\"completion_tokens\":8,\"prompt_tokens\":14,\"total_tokens\":22}}\n","responseCode":200,"responseSize":1604,"url":"https://azure-aifoundry-apm.azure-api.net/deployments/gpt-chat-pilot/chat/completions?api-version=2024-02-15-preview"},"resourceId":"/SUBSCRIPTIONS/12345CABCB4-86E8-404F-A3D2-1DC9982F45CA/RESOURCEGROUPS/OBS-AIFOUNDRY-APIM-TEST/PROVIDERS/MICROSOFT.APIMANAGEMENT/SERVICE/AZURE-AIFOUNDRY-APM","resultType":"Succeeded","time":"2024-07-02T06:31:31.4465902Z","truncated":0} +{"DeploymentVersion":"0.44.18652.0","Level":4,"Sku":"Basic","callerIpAddress":"81.2.69.144","category":"GatewayLogs","correlationId":"0aa398fe-7b98-49aa-8352-52ce04ddc34a","durationMs":453,"isRequestSuccess":false,"location":"East US","operationName":"Microsoft.ApiManagement/GatewayLogs","properties":{"apiId":"azure-ai-foundry-apim-api","apiRevision":"1","backendMethod":"POST","backendProtocol":"HTTP/1.1","backendRequestBody":"{\"model\": \"gpt-chat-pilot\", \"messages\": [{\"role\": \"user\", \"content\": \"test\"}]}","backendResponseBody":"{\"error\":{\"message\":\"The response was filtered due to the prompt triggering Azure AI Foundry's content management policy. Please modify your prompt and retry. To learn more about our content filtering policies please read our documentation: https://go.microsoft.com/fwlink/?linkid=2198766\",\"type\":null,\"param\":\"prompt\",\"code\":\"content_filter\",\"status\":400,\"innererror\":{\"code\":\"ResponsibleAIPolicyViolation\",\"content_filter_result\":{\"custom_blocklists\":[{\"filtered\":true,\"id\":\"CustomBlockList601\"}],\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"profanity\":{\"filtered\":false,\"detected\":false},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}}}","backendResponseCode":400,"backendTime":452,"backendUrl":"https://obs-aifoundry-test-01.aifoundry.azure.com/aifoundry/deployments/gpt-chat-pilot/chat/completions?api-version=2024-02-15-preview","cache":"none","clientProtocol":"HTTP/1.1","clientTlsVersion":"1.3","method":"POST","operationId":"ChatCompletions_Create","requestBody":"{\"model\": \"gpt-chat-pilot\", \"messages\": [{\"role\": \"user\", \"content\": \"test\"}]}","requestSize":519,"responseBody":"{\"error\":{\"message\":\"The response was filtered due to the prompt triggering Azure AI Foundry's content management policy. Please modify your prompt and retry. To learn more about our content filtering policies please read our documentation: https://go.microsoft.com/fwlink/?linkid=2198766\",\"type\":null,\"param\":\"prompt\",\"code\":\"content_filter\",\"status\":400,\"innererror\":{\"code\":\"ResponsibleAIPolicyViolation\",\"content_filter_result\":{\"custom_blocklists\":[{\"filtered\":true,\"id\":\"CustomBlockList601\"}],\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"profanity\":{\"filtered\":false,\"detected\":false},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}}}","responseCode":400,"responseSize":1360,"url":"https://azure-aifoundry-apm.azure-api.net/deployments/gpt-chat-pilot/chat/completions?api-version=2024-02-15-preview"},"resourceId":"/SUBSCRIPTIONS/12345CABCB4-86E8-404F-A3D2-1DC9982F45CA/RESOURCEGROUPS/OBS-AIFOUNDRY-APIM-TEST/PROVIDERS/MICROSOFT.APIMANAGEMENT/SERVICE/AZURE-AIFOUNDRY-APM","resultType":"Failed","time":"2024-07-02T06:14:56.2371877Z","truncated":0} +{"DeploymentVersion":"0.47.21405.0","Level":4,"Sku":"Basic","callerIpAddress":"81.2.69.144","category":"GatewayLogs","correlationId":"503d647d-3f8c-45b4-a9df-ec02ec01e988","durationMs":811,"isRequestSuccess":false,"location":"East US","operationName":"Microsoft.ApiManagement/GatewayLogs","properties":{"apiId":"azure-ai-foundry-apim-api","apiRevision":"1","backendMethod":"POST","backendProtocol":"HTTP/1.1","backendRequestBody":"{\"model\": \"gpt-chat-pilot\", \"messages\": [{\"role\": \"user\", \"content\": \"virus\"}]}","backendResponseBody":"{\"error\":{\"message\":\"The response was filtered due to the prompt triggering Azure AI Foundry's content management policy. Please modify your prompt and retry. To learn more about our content filtering policies please read our documentation: https://go.microsoft.com/fwlink/?linkid=2198766\",\"type\":null,\"param\":\"prompt\",\"code\":\"content_filter\",\"status\":400,\"innererror\":{\"code\":\"ResponsibleAIPolicyViolation\",\"content_filter_result\":{\"custom_blocklists\":[{\"filtered\":true,\"id\":\"CustomBlockList601\"}],\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"jailbreak\":{\"filtered\":false,\"detected\":false},\"profanity\":{\"filtered\":false,\"detected\":false},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":true,\"severity\":\"medium\"}}}}}","backendResponseCode":400,"backendTime":810,"backendUrl":"https://obs-aifoundry-test-01.aifoundry.azure.com/aifoundry/deployments/gpt-chat-pilot/chat/completions?api-version=2024-02-15-preview","cache":"none","clientProtocol":"HTTP/1.1","clientTlsCipherSuite":"TLS_UNK0_WITH_AES_256_GCM_SHA384","clientTlsVersion":"1.3","method":"POST","operationId":"ChatCompletions_Create","requestBody":"{\"model\": \"gpt-chat-pilot\", \"messages\": [{\"role\": \"user\", \"content\": \"virus\"}]}","requestSize":496,"responseBody":"{\"error\":{\"message\":\"The response was filtered due to the prompt triggering Azure AI Foundry's content management policy. Please modify your prompt and retry. To learn more about our content filtering policies please read our documentation: https://go.microsoft.com/fwlink/?linkid=2198766\",\"type\":null,\"param\":\"prompt\",\"code\":\"content_filter\",\"status\":400,\"innererror\":{\"code\":\"ResponsibleAIPolicyViolation\",\"content_filter_result\":{\"custom_blocklists\":[{\"filtered\":true,\"id\":\"CustomBlockList601\"}],\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"jailbreak\":{\"filtered\":false,\"detected\":false},\"profanity\":{\"filtered\":false,\"detected\":false},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":false,\"severity\":\"safe\"}}}}}","responseCode":400,"responseSize":1471,"url":"https://azure-aifoundry-apm.azure-api.net/deployments/gpt-chat-pilot/chat/completions?api-version=2024-02-15-preview"},"resourceId":"/SUBSCRIPTIONS/12345CABCB4-86E8-404F-A3D2-1DC9982F45CA/RESOURCEGROUPS/OBS-AIFOUNDRY-APIM-TEST/PROVIDERS/MICROSOFT.APIMANAGEMENT/SERVICE/AZURE-AIFOUNDRY-APM","resultType":"Failed","time":"2025-03-05T10:39:40.2260356Z","truncated":0} +{"DeploymentVersion":"0.48.2706.0","Level":4,"Sku":"StandardV2","callerIpAddress":"81.2.69.144","category":"GatewayLogs","correlationId":"134005c6-ef24-4eb3-ab74-08fad5176d5f","durationMs":336,"isRequestSuccess":false,"location":"East US","operationName":"Microsoft.ApiManagement/GatewayLogs","properties":{"apiId":"azure-ai-foundry-apim-api","apiRevision":"1","backendId":"azure-ai-foundry-apim-api-ai-endpoint","backendMethod":"POST","backendProtocol":"HTTP/1.1","backendRequestBody":"{\"model\": \"gpt-4o\", \"messages\": [{\"role\": \"user\", \"content\": \"how to kill a dog?\"}]}","backendResponseBody":"{\"error\":{\"message\":\"The response was filtered due to the prompt triggering Azure AI Foundry's content management policy. Please modify your prompt and retry. To learn more about our content filtering policies please read our documentation: https://go.microsoft.com/fwlink/?linkid=2198766\",\"type\":null,\"param\":\"prompt\",\"code\":\"content_filter\",\"status\":400,\"innererror\":{\"code\":\"ResponsibleAIPolicyViolation\",\"content_filter_result\":{\"custom_blocklists\":{\"filtered\":false},\"hate\":{\"filtered\":false,\"severity\":\"safe\"},\"jailbreak\":{\"filtered\":false,\"detected\":false},\"profanity\":{\"filtered\":false,\"detected\":false},\"self_harm\":{\"filtered\":false,\"severity\":\"safe\"},\"sexual\":{\"filtered\":false,\"severity\":\"safe\"},\"violence\":{\"filtered\":true,\"severity\":\"medium\"}}}}}","backendResponseCode":400,"backendTime":624,"backendUrl":"https://ai-muthuhub687016784742.services.ai.azure.com/models/chat/completions?api-version=2024-05-01-preview","cache":"none","clientProtocol":"HTTP/1.1","method":"POST","operationId":"getChatCompletions","responseCode":400,"responseSize":1311,"url":"https://azure-ai-foundry-apim.azure-api.net/aifoundry/models/chat/completions?api-version=2024-05-01-preview"},"resourceId":"/SUBSCRIPTIONS/12345CABCB4-86E8-404F-A3D2-1DC9982F45CA/RESOURCEGROUPS/OBS-AIFOUNDRY-APIM-TEST/PROVIDERS/MICROSOFT.APIMANAGEMENT/SERVICE/AZURE-AI-FOUNDRY-APIM","resultType":"Failed","serviceName":"azure-ai-foundry-apim","time":"2025-06-23T11:21:53.3239304Z","truncated":0 } \ No newline at end of file diff --git a/packages/azure_ai_foundry/data_stream/logs/_dev/test/pipeline/test-ai-foundry-gateway.log-expected.json b/packages/azure_ai_foundry/data_stream/logs/_dev/test/pipeline/test-ai-foundry-gateway.log-expected.json new file mode 100644 index 00000000000..c728e2eaef4 --- /dev/null +++ b/packages/azure_ai_foundry/data_stream/logs/_dev/test/pipeline/test-ai-foundry-gateway.log-expected.json @@ -0,0 +1,569 @@ +{ + "expected": [ + { + "@timestamp": "2024-07-02T06:31:31.446Z", + "azure": { + "ai_foundry": { + "category": "GatewayLogs", + "correlation_id": "99789635-18d0-480f-8182-a3a3c477a6a4", + "deployment_version": "0.44.18652.0", + "duration_ms": 176, + "is_request_success": true, + "location": "East US", + "operation_name": "Microsoft.ApiManagement/GatewayLogs", + "properties": { + "api_id": "azure-ai-foundry-apim-api", + "api_revision": "1", + "backend_method": "POST", + "backend_protocol": "HTTP/1.1", + "backend_request_body": { + "messages": [ + { + "content": "capital of tamilnadu?", + "role": "user" + } + ], + "model": "gpt-chat-pilot" + }, + "backend_response_body": { + "choices": [ + { + "content_filter_results": { + "hate": { + "filtered": true, + "severity": "low" + }, + "profanity": { + "detected": false, + "filtered": false + }, + "self_harm": { + "filtered": false, + "severity": "safe" + }, + "sexual": { + "filtered": false, + "severity": "safe" + }, + "violence": { + "filtered": false, + "severity": "safe" + } + }, + "finish_reason": "stop", + "index": 0, + "message": { + "content": "The capital of Tamil Nadu is Chennai.", + "role": "assistant" + } + } + ], + "content_filtered_categories": [ + { + "category_name": "hate", + "severity": "low" + } + ], + "created": 1719901891, + "id": "chatcmpl-9gRL14hGa8nQstOJKvLjh7EyulsnT", + "model": "gpt-35-turbo", + "object": "chat.completion", + "prompt_filter_results": [ + { + "content_filter_results": { + "hate": { + "filtered": false, + "severity": "safe" + }, + "profanity": { + "detected": false, + "filtered": false + }, + "self_harm": { + "filtered": false, + "severity": "safe" + }, + "sexual": { + "filtered": false, + "severity": "safe" + }, + "violence": { + "filtered": false, + "severity": "safe" + } + }, + "prompt_index": 0 + } + ], + "usage": { + "input_tokens": 14, + "output_tokens": 8, + "total_tokens": 22 + } + }, + "backend_response_code": 200, + "backend_time": 176, + "backend_url": "https://obs-aifoundry-test-01.aifoundry.azure.com/aifoundry/deployments/gpt-chat-pilot/chat/completions?api-version=2024-02-15-preview", + "cache": "none", + "client_protocol": "HTTP/1.1", + "client_tls_version": "1.3", + "operation_id": "ChatCompletions_Create", + "request_length": 536, + "response_length": 1604 + }, + "sku": "Basic", + "truncated": 0 + }, + "resource": { + "id": "/subscriptions/12345cabcb4-86e8-404f-a3d2-1dc9982f45ca/resourcegroups/obs-aifoundry-apim-test/providers/microsoft.apimanagement/service/azure-aifoundry-apm" + } + }, + "cloud": { + "provider": "azure" + }, + "event": { + "duration": 176000000, + "original": "{\"DeploymentVersion\":\"0.44.18652.0\",\"Level\":4,\"Sku\":\"Basic\",\"callerIpAddress\":\"89.160.20.156\",\"category\":\"GatewayLogs\",\"correlationId\":\"99789635-18d0-480f-8182-a3a3c477a6a4\",\"durationMs\":176,\"isRequestSuccess\":true,\"location\":\"East US\",\"operationName\":\"Microsoft.ApiManagement/GatewayLogs\",\"properties\":{\"apiId\":\"azure-ai-foundry-apim-api\",\"apiRevision\":\"1\",\"backendMethod\":\"POST\",\"backendProtocol\":\"HTTP/1.1\",\"backendRequestBody\":\"{\\\"model\\\": \\\"gpt-chat-pilot\\\", \\\"messages\\\": [{\\\"role\\\": \\\"user\\\", \\\"content\\\": \\\"capital of tamilnadu?\\\"}]}\",\"backendResponseBody\":\"{\\\"choices\\\":[{\\\"content_filter_results\\\":{\\\"custom_blocklists\\\":[],\\\"hate\\\":{\\\"filtered\\\":true,\\\"severity\\\":\\\"low\\\"},\\\"profanity\\\":{\\\"filtered\\\":false,\\\"detected\\\":false},\\\"self_harm\\\":{\\\"filtered\\\":false,\\\"severity\\\":\\\"safe\\\"},\\\"sexual\\\":{\\\"filtered\\\":false,\\\"severity\\\":\\\"safe\\\"},\\\"violence\\\":{\\\"filtered\\\":false,\\\"severity\\\":\\\"safe\\\"}},\\\"finish_reason\\\":\\\"stop\\\",\\\"index\\\":0,\\\"logprobs\\\":null,\\\"message\\\":{\\\"content\\\":\\\"The capital of Tamil Nadu is Chennai.\\\",\\\"role\\\":\\\"assistant\\\"}}],\\\"created\\\":1719901891,\\\"id\\\":\\\"chatcmpl-9gRL14hGa8nQstOJKvLjh7EyulsnT\\\",\\\"model\\\":\\\"gpt-35-turbo\\\",\\\"object\\\":\\\"chat.completion\\\",\\\"prompt_filter_results\\\":[{\\\"prompt_index\\\":0,\\\"content_filter_results\\\":{\\\"custom_blocklists\\\":[],\\\"hate\\\":{\\\"filtered\\\":false,\\\"severity\\\":\\\"safe\\\"},\\\"profanity\\\":{\\\"filtered\\\":false,\\\"detected\\\":false},\\\"self_harm\\\":{\\\"filtered\\\":false,\\\"severity\\\":\\\"safe\\\"},\\\"sexual\\\":{\\\"filtered\\\":false,\\\"severity\\\":\\\"safe\\\"},\\\"violence\\\":{\\\"filtered\\\":false,\\\"severity\\\":\\\"safe\\\"}}}],\\\"system_fingerprint\\\":null,\\\"usage\\\":{\\\"completion_tokens\\\":8,\\\"prompt_tokens\\\":14,\\\"total_tokens\\\":22}}\\n\",\"backendResponseCode\":200,\"backendTime\":176,\"backendUrl\":\"https://obs-aifoundry-test-01.aifoundry.azure.com/aifoundry/deployments/gpt-chat-pilot/chat/completions?api-version=2024-02-15-preview\",\"cache\":\"none\",\"clientProtocol\":\"HTTP/1.1\",\"clientTlsVersion\":\"1.3\",\"method\":\"POST\",\"operationId\":\"ChatCompletions_Create\",\"requestBody\":\"{\\\"model\\\": \\\"gpt-chat-pilot\\\", \\\"messages\\\": [{\\\"role\\\": \\\"user\\\", \\\"content\\\": \\\"capital of tamilnadu?\\\"}]}\",\"requestSize\":536,\"responseBody\":\"{\\\"choices\\\":[{\\\"content_filter_results\\\":{\\\"custom_blocklists\\\":[],\\\"hate\\\":{\\\"filtered\\\":false,\\\"severity\\\":\\\"safe\\\"},\\\"profanity\\\":{\\\"filtered\\\":false,\\\"detected\\\":false},\\\"self_harm\\\":{\\\"filtered\\\":false,\\\"severity\\\":\\\"safe\\\"},\\\"sexual\\\":{\\\"filtered\\\":false,\\\"severity\\\":\\\"safe\\\"},\\\"violence\\\":{\\\"filtered\\\":false,\\\"severity\\\":\\\"safe\\\"}},\\\"finish_reason\\\":\\\"stop\\\",\\\"index\\\":0,\\\"logprobs\\\":null,\\\"message\\\":{\\\"content\\\":\\\"The capital of Tamil Nadu is Chennai.\\\",\\\"role\\\":\\\"assistant\\\"}}],\\\"created\\\":1719901891,\\\"id\\\":\\\"chatcmpl-9gRL14hGa8nQstOJKvLjh7EyulsnT\\\",\\\"model\\\":\\\"gpt-35-turbo\\\",\\\"object\\\":\\\"chat.completion\\\",\\\"prompt_filter_results\\\":[{\\\"prompt_index\\\":0,\\\"content_filter_results\\\":{\\\"custom_blocklists\\\":[],\\\"hate\\\":{\\\"filtered\\\":false,\\\"severity\\\":\\\"safe\\\"},\\\"profanity\\\":{\\\"filtered\\\":false,\\\"detected\\\":false},\\\"self_harm\\\":{\\\"filtered\\\":false,\\\"severity\\\":\\\"safe\\\"},\\\"sexual\\\":{\\\"filtered\\\":false,\\\"severity\\\":\\\"safe\\\"},\\\"violence\\\":{\\\"filtered\\\":false,\\\"severity\\\":\\\"safe\\\"}}}],\\\"system_fingerprint\\\":null,\\\"usage\\\":{\\\"completion_tokens\\\":8,\\\"prompt_tokens\\\":14,\\\"total_tokens\\\":22}}\\n\",\"responseCode\":200,\"responseSize\":1604,\"url\":\"https://azure-aifoundry-apm.azure-api.net/deployments/gpt-chat-pilot/chat/completions?api-version=2024-02-15-preview\"},\"resourceId\":\"/SUBSCRIPTIONS/12345CABCB4-86E8-404F-A3D2-1DC9982F45CA/RESOURCEGROUPS/OBS-AIFOUNDRY-APIM-TEST/PROVIDERS/MICROSOFT.APIMANAGEMENT/SERVICE/AZURE-AIFOUNDRY-APM\",\"resultType\":\"Succeeded\",\"time\":\"2024-07-02T06:31:31.4465902Z\",\"truncated\":0}", + "outcome": "success" + }, + "http": { + "request": { + "method": "POST" + }, + "response": { + "status_code": 200 + } + }, + "log": { + "level": "4" + }, + "source": { + "as": { + "number": 29518, + "organization": { + "name": "Bredband2 AB" + } + }, + "geo": { + "city_name": "Linköping", + "continent_name": "Europe", + "country_iso_code": "SE", + "country_name": "Sweden", + "location": { + "lat": 58.4167, + "lon": 15.6167 + }, + "region_iso_code": "SE-E", + "region_name": "Östergötland County" + }, + "ip": "89.160.20.156" + }, + "tags": [ + "preserve_original_event" + ], + "url": { + "domain": "azure-aifoundry-apm.azure-api.net", + "original": "https://azure-aifoundry-apm.azure-api.net/deployments/gpt-chat-pilot/chat/completions?api-version=2024-02-15-preview", + "path": "/deployments/gpt-chat-pilot/chat/completions", + "query": "api-version=2024-02-15-preview", + "scheme": "https" + } + }, + { + "@timestamp": "2024-07-02T06:14:56.237Z", + "azure": { + "ai_foundry": { + "category": "GatewayLogs", + "correlation_id": "0aa398fe-7b98-49aa-8352-52ce04ddc34a", + "deployment_version": "0.44.18652.0", + "duration_ms": 453, + "is_request_success": false, + "location": "East US", + "operation_name": "Microsoft.ApiManagement/GatewayLogs", + "properties": { + "api_id": "azure-ai-foundry-apim-api", + "api_revision": "1", + "backend_method": "POST", + "backend_protocol": "HTTP/1.1", + "backend_request_body": { + "messages": [ + { + "content": "test", + "role": "user" + } + ], + "model": "gpt-chat-pilot" + }, + "backend_response_body": { + "error": { + "code": "content_filter", + "innererror": { + "code": "ResponsibleAIPolicyViolation", + "content_filter_result": { + "custom_blocklists": [ + { + "filtered": true, + "id": "CustomBlockList601" + } + ], + "hate": { + "filtered": false, + "severity": "safe" + }, + "profanity": { + "detected": false, + "filtered": false + }, + "self_harm": { + "filtered": false, + "severity": "safe" + }, + "sexual": { + "filtered": false, + "severity": "safe" + }, + "violence": { + "filtered": false, + "severity": "safe" + } + } + }, + "message": "The response was filtered due to the prompt triggering Azure AI Foundry's content management policy. Please modify your prompt and retry. To learn more about our content filtering policies please read our documentation: https://go.microsoft.com/fwlink/?linkid=2198766", + "param": "prompt", + "status": 400 + } + }, + "backend_response_code": 400, + "backend_time": 452, + "backend_url": "https://obs-aifoundry-test-01.aifoundry.azure.com/aifoundry/deployments/gpt-chat-pilot/chat/completions?api-version=2024-02-15-preview", + "cache": "none", + "client_protocol": "HTTP/1.1", + "client_tls_version": "1.3", + "operation_id": "ChatCompletions_Create", + "request_length": 519, + "response_length": 1360 + }, + "sku": "Basic", + "truncated": 0 + }, + "resource": { + "id": "/subscriptions/12345cabcb4-86e8-404f-a3d2-1dc9982f45ca/resourcegroups/obs-aifoundry-apim-test/providers/microsoft.apimanagement/service/azure-aifoundry-apm" + } + }, + "cloud": { + "provider": "azure" + }, + "event": { + "duration": 453000000, + "original": "{\"DeploymentVersion\":\"0.44.18652.0\",\"Level\":4,\"Sku\":\"Basic\",\"callerIpAddress\":\"81.2.69.144\",\"category\":\"GatewayLogs\",\"correlationId\":\"0aa398fe-7b98-49aa-8352-52ce04ddc34a\",\"durationMs\":453,\"isRequestSuccess\":false,\"location\":\"East US\",\"operationName\":\"Microsoft.ApiManagement/GatewayLogs\",\"properties\":{\"apiId\":\"azure-ai-foundry-apim-api\",\"apiRevision\":\"1\",\"backendMethod\":\"POST\",\"backendProtocol\":\"HTTP/1.1\",\"backendRequestBody\":\"{\\\"model\\\": \\\"gpt-chat-pilot\\\", \\\"messages\\\": [{\\\"role\\\": \\\"user\\\", \\\"content\\\": \\\"test\\\"}]}\",\"backendResponseBody\":\"{\\\"error\\\":{\\\"message\\\":\\\"The response was filtered due to the prompt triggering Azure AI Foundry's content management policy. Please modify your prompt and retry. To learn more about our content filtering policies please read our documentation: https://go.microsoft.com/fwlink/?linkid=2198766\\\",\\\"type\\\":null,\\\"param\\\":\\\"prompt\\\",\\\"code\\\":\\\"content_filter\\\",\\\"status\\\":400,\\\"innererror\\\":{\\\"code\\\":\\\"ResponsibleAIPolicyViolation\\\",\\\"content_filter_result\\\":{\\\"custom_blocklists\\\":[{\\\"filtered\\\":true,\\\"id\\\":\\\"CustomBlockList601\\\"}],\\\"hate\\\":{\\\"filtered\\\":false,\\\"severity\\\":\\\"safe\\\"},\\\"profanity\\\":{\\\"filtered\\\":false,\\\"detected\\\":false},\\\"self_harm\\\":{\\\"filtered\\\":false,\\\"severity\\\":\\\"safe\\\"},\\\"sexual\\\":{\\\"filtered\\\":false,\\\"severity\\\":\\\"safe\\\"},\\\"violence\\\":{\\\"filtered\\\":false,\\\"severity\\\":\\\"safe\\\"}}}}}\",\"backendResponseCode\":400,\"backendTime\":452,\"backendUrl\":\"https://obs-aifoundry-test-01.aifoundry.azure.com/aifoundry/deployments/gpt-chat-pilot/chat/completions?api-version=2024-02-15-preview\",\"cache\":\"none\",\"clientProtocol\":\"HTTP/1.1\",\"clientTlsVersion\":\"1.3\",\"method\":\"POST\",\"operationId\":\"ChatCompletions_Create\",\"requestBody\":\"{\\\"model\\\": \\\"gpt-chat-pilot\\\", \\\"messages\\\": [{\\\"role\\\": \\\"user\\\", \\\"content\\\": \\\"test\\\"}]}\",\"requestSize\":519,\"responseBody\":\"{\\\"error\\\":{\\\"message\\\":\\\"The response was filtered due to the prompt triggering Azure AI Foundry's content management policy. Please modify your prompt and retry. To learn more about our content filtering policies please read our documentation: https://go.microsoft.com/fwlink/?linkid=2198766\\\",\\\"type\\\":null,\\\"param\\\":\\\"prompt\\\",\\\"code\\\":\\\"content_filter\\\",\\\"status\\\":400,\\\"innererror\\\":{\\\"code\\\":\\\"ResponsibleAIPolicyViolation\\\",\\\"content_filter_result\\\":{\\\"custom_blocklists\\\":[{\\\"filtered\\\":true,\\\"id\\\":\\\"CustomBlockList601\\\"}],\\\"hate\\\":{\\\"filtered\\\":false,\\\"severity\\\":\\\"safe\\\"},\\\"profanity\\\":{\\\"filtered\\\":false,\\\"detected\\\":false},\\\"self_harm\\\":{\\\"filtered\\\":false,\\\"severity\\\":\\\"safe\\\"},\\\"sexual\\\":{\\\"filtered\\\":false,\\\"severity\\\":\\\"safe\\\"},\\\"violence\\\":{\\\"filtered\\\":false,\\\"severity\\\":\\\"safe\\\"}}}}}\",\"responseCode\":400,\"responseSize\":1360,\"url\":\"https://azure-aifoundry-apm.azure-api.net/deployments/gpt-chat-pilot/chat/completions?api-version=2024-02-15-preview\"},\"resourceId\":\"/SUBSCRIPTIONS/12345CABCB4-86E8-404F-A3D2-1DC9982F45CA/RESOURCEGROUPS/OBS-AIFOUNDRY-APIM-TEST/PROVIDERS/MICROSOFT.APIMANAGEMENT/SERVICE/AZURE-AIFOUNDRY-APM\",\"resultType\":\"Failed\",\"time\":\"2024-07-02T06:14:56.2371877Z\",\"truncated\":0}", + "outcome": "failure" + }, + "http": { + "request": { + "method": "POST" + }, + "response": { + "status_code": 400 + } + }, + "log": { + "level": "4" + }, + "source": { + "geo": { + "city_name": "London", + "continent_name": "Europe", + "country_iso_code": "GB", + "country_name": "United Kingdom", + "location": { + "lat": 51.5142, + "lon": -0.0931 + }, + "region_iso_code": "GB-ENG", + "region_name": "England" + }, + "ip": "81.2.69.144" + }, + "tags": [ + "preserve_original_event" + ], + "url": { + "domain": "azure-aifoundry-apm.azure-api.net", + "original": "https://azure-aifoundry-apm.azure-api.net/deployments/gpt-chat-pilot/chat/completions?api-version=2024-02-15-preview", + "path": "/deployments/gpt-chat-pilot/chat/completions", + "query": "api-version=2024-02-15-preview", + "scheme": "https" + } + }, + { + "@timestamp": "2025-03-05T10:39:40.226Z", + "azure": { + "ai_foundry": { + "category": "GatewayLogs", + "correlation_id": "503d647d-3f8c-45b4-a9df-ec02ec01e988", + "deployment_version": "0.47.21405.0", + "duration_ms": 811, + "is_request_success": false, + "location": "East US", + "operation_name": "Microsoft.ApiManagement/GatewayLogs", + "properties": { + "api_id": "azure-ai-foundry-apim-api", + "api_revision": "1", + "backend_method": "POST", + "backend_protocol": "HTTP/1.1", + "backend_request_body": { + "messages": [ + { + "content": "virus", + "role": "user" + } + ], + "model": "gpt-chat-pilot" + }, + "backend_response_body": { + "error": { + "code": "content_filter", + "innererror": { + "code": "ResponsibleAIPolicyViolation", + "content_filter_result": { + "custom_blocklists": [ + { + "filtered": true, + "id": "CustomBlockList601" + } + ], + "hate": { + "filtered": false, + "severity": "safe" + }, + "jailbreak": { + "detected": false, + "filtered": false + }, + "profanity": { + "detected": false, + "filtered": false + }, + "self_harm": { + "filtered": false, + "severity": "safe" + }, + "sexual": { + "filtered": false, + "severity": "safe" + }, + "violence": { + "filtered": true, + "severity": "medium" + } + }, + "content_filtered_categories": [ + { + "category_name": "violence", + "severity": "medium" + } + ] + }, + "message": "The response was filtered due to the prompt triggering Azure AI Foundry's content management policy. Please modify your prompt and retry. To learn more about our content filtering policies please read our documentation: https://go.microsoft.com/fwlink/?linkid=2198766", + "param": "prompt", + "status": 400 + } + }, + "backend_response_code": 400, + "backend_time": 810, + "backend_url": "https://obs-aifoundry-test-01.aifoundry.azure.com/aifoundry/deployments/gpt-chat-pilot/chat/completions?api-version=2024-02-15-preview", + "cache": "none", + "client_protocol": "HTTP/1.1", + "client_tls_cipher_suite": "TLS_UNK0_WITH_AES_256_GCM_SHA384", + "client_tls_version": "1.3", + "operation_id": "ChatCompletions_Create", + "request_length": 496, + "response_length": 1471 + }, + "sku": "Basic", + "truncated": 0 + }, + "resource": { + "id": "/subscriptions/12345cabcb4-86e8-404f-a3d2-1dc9982f45ca/resourcegroups/obs-aifoundry-apim-test/providers/microsoft.apimanagement/service/azure-aifoundry-apm" + } + }, + "cloud": { + "provider": "azure" + }, + "event": { + "duration": 811000000, + "original": "{\"DeploymentVersion\":\"0.47.21405.0\",\"Level\":4,\"Sku\":\"Basic\",\"callerIpAddress\":\"81.2.69.144\",\"category\":\"GatewayLogs\",\"correlationId\":\"503d647d-3f8c-45b4-a9df-ec02ec01e988\",\"durationMs\":811,\"isRequestSuccess\":false,\"location\":\"East US\",\"operationName\":\"Microsoft.ApiManagement/GatewayLogs\",\"properties\":{\"apiId\":\"azure-ai-foundry-apim-api\",\"apiRevision\":\"1\",\"backendMethod\":\"POST\",\"backendProtocol\":\"HTTP/1.1\",\"backendRequestBody\":\"{\\\"model\\\": \\\"gpt-chat-pilot\\\", \\\"messages\\\": [{\\\"role\\\": \\\"user\\\", \\\"content\\\": \\\"virus\\\"}]}\",\"backendResponseBody\":\"{\\\"error\\\":{\\\"message\\\":\\\"The response was filtered due to the prompt triggering Azure AI Foundry's content management policy. Please modify your prompt and retry. To learn more about our content filtering policies please read our documentation: https://go.microsoft.com/fwlink/?linkid=2198766\\\",\\\"type\\\":null,\\\"param\\\":\\\"prompt\\\",\\\"code\\\":\\\"content_filter\\\",\\\"status\\\":400,\\\"innererror\\\":{\\\"code\\\":\\\"ResponsibleAIPolicyViolation\\\",\\\"content_filter_result\\\":{\\\"custom_blocklists\\\":[{\\\"filtered\\\":true,\\\"id\\\":\\\"CustomBlockList601\\\"}],\\\"hate\\\":{\\\"filtered\\\":false,\\\"severity\\\":\\\"safe\\\"},\\\"jailbreak\\\":{\\\"filtered\\\":false,\\\"detected\\\":false},\\\"profanity\\\":{\\\"filtered\\\":false,\\\"detected\\\":false},\\\"self_harm\\\":{\\\"filtered\\\":false,\\\"severity\\\":\\\"safe\\\"},\\\"sexual\\\":{\\\"filtered\\\":false,\\\"severity\\\":\\\"safe\\\"},\\\"violence\\\":{\\\"filtered\\\":true,\\\"severity\\\":\\\"medium\\\"}}}}}\",\"backendResponseCode\":400,\"backendTime\":810,\"backendUrl\":\"https://obs-aifoundry-test-01.aifoundry.azure.com/aifoundry/deployments/gpt-chat-pilot/chat/completions?api-version=2024-02-15-preview\",\"cache\":\"none\",\"clientProtocol\":\"HTTP/1.1\",\"clientTlsCipherSuite\":\"TLS_UNK0_WITH_AES_256_GCM_SHA384\",\"clientTlsVersion\":\"1.3\",\"method\":\"POST\",\"operationId\":\"ChatCompletions_Create\",\"requestBody\":\"{\\\"model\\\": \\\"gpt-chat-pilot\\\", \\\"messages\\\": [{\\\"role\\\": \\\"user\\\", \\\"content\\\": \\\"virus\\\"}]}\",\"requestSize\":496,\"responseBody\":\"{\\\"error\\\":{\\\"message\\\":\\\"The response was filtered due to the prompt triggering Azure AI Foundry's content management policy. Please modify your prompt and retry. To learn more about our content filtering policies please read our documentation: https://go.microsoft.com/fwlink/?linkid=2198766\\\",\\\"type\\\":null,\\\"param\\\":\\\"prompt\\\",\\\"code\\\":\\\"content_filter\\\",\\\"status\\\":400,\\\"innererror\\\":{\\\"code\\\":\\\"ResponsibleAIPolicyViolation\\\",\\\"content_filter_result\\\":{\\\"custom_blocklists\\\":[{\\\"filtered\\\":true,\\\"id\\\":\\\"CustomBlockList601\\\"}],\\\"hate\\\":{\\\"filtered\\\":false,\\\"severity\\\":\\\"safe\\\"},\\\"jailbreak\\\":{\\\"filtered\\\":false,\\\"detected\\\":false},\\\"profanity\\\":{\\\"filtered\\\":false,\\\"detected\\\":false},\\\"self_harm\\\":{\\\"filtered\\\":false,\\\"severity\\\":\\\"safe\\\"},\\\"sexual\\\":{\\\"filtered\\\":false,\\\"severity\\\":\\\"safe\\\"},\\\"violence\\\":{\\\"filtered\\\":false,\\\"severity\\\":\\\"safe\\\"}}}}}\",\"responseCode\":400,\"responseSize\":1471,\"url\":\"https://azure-aifoundry-apm.azure-api.net/deployments/gpt-chat-pilot/chat/completions?api-version=2024-02-15-preview\"},\"resourceId\":\"/SUBSCRIPTIONS/12345CABCB4-86E8-404F-A3D2-1DC9982F45CA/RESOURCEGROUPS/OBS-AIFOUNDRY-APIM-TEST/PROVIDERS/MICROSOFT.APIMANAGEMENT/SERVICE/AZURE-AIFOUNDRY-APM\",\"resultType\":\"Failed\",\"time\":\"2025-03-05T10:39:40.2260356Z\",\"truncated\":0}", + "outcome": "failure" + }, + "http": { + "request": { + "method": "POST" + }, + "response": { + "status_code": 400 + } + }, + "log": { + "level": "4" + }, + "source": { + "geo": { + "city_name": "London", + "continent_name": "Europe", + "country_iso_code": "GB", + "country_name": "United Kingdom", + "location": { + "lat": 51.5142, + "lon": -0.0931 + }, + "region_iso_code": "GB-ENG", + "region_name": "England" + }, + "ip": "81.2.69.144" + }, + "tags": [ + "preserve_original_event" + ], + "url": { + "domain": "azure-aifoundry-apm.azure-api.net", + "original": "https://azure-aifoundry-apm.azure-api.net/deployments/gpt-chat-pilot/chat/completions?api-version=2024-02-15-preview", + "path": "/deployments/gpt-chat-pilot/chat/completions", + "query": "api-version=2024-02-15-preview", + "scheme": "https" + } + }, + { + "@timestamp": "2025-06-23T11:21:53.323Z", + "azure": { + "ai_foundry": { + "category": "GatewayLogs", + "correlation_id": "134005c6-ef24-4eb3-ab74-08fad5176d5f", + "deployment_version": "0.48.2706.0", + "duration_ms": 336, + "is_request_success": false, + "location": "East US", + "operation_name": "Microsoft.ApiManagement/GatewayLogs", + "properties": { + "api_id": "azure-ai-foundry-apim-api", + "api_revision": "1", + "backend_id": "azure-ai-foundry-apim-api-ai-endpoint", + "backend_method": "POST", + "backend_protocol": "HTTP/1.1", + "backend_request_body": { + "messages": [ + { + "content": "how to kill a dog?", + "role": "user" + } + ], + "model": "gpt-4o" + }, + "backend_response_body": { + "error": { + "code": "content_filter", + "innererror": { + "code": "ResponsibleAIPolicyViolation", + "content_filter_result": { + "custom_blocklists": { + "filtered": false + }, + "hate": { + "filtered": false, + "severity": "safe" + }, + "jailbreak": { + "detected": false, + "filtered": false + }, + "profanity": { + "detected": false, + "filtered": false + }, + "self_harm": { + "filtered": false, + "severity": "safe" + }, + "sexual": { + "filtered": false, + "severity": "safe" + }, + "violence": { + "filtered": true, + "severity": "medium" + } + }, + "content_filtered_categories": [ + { + "category_name": "violence", + "severity": "medium" + } + ] + }, + "message": "The response was filtered due to the prompt triggering Azure AI Foundry's content management policy. Please modify your prompt and retry. To learn more about our content filtering policies please read our documentation: https://go.microsoft.com/fwlink/?linkid=2198766", + "param": "prompt", + "status": 400 + } + }, + "backend_response_code": 400, + "backend_time": 624, + "backend_url": "https://ai-muthuhub687016784742.services.ai.azure.com/models/chat/completions?api-version=2024-05-01-preview", + "cache": "none", + "client_protocol": "HTTP/1.1", + "operation_id": "getChatCompletions", + "response_length": 1311 + }, + "service_name": "azure-ai-foundry-apim", + "sku": "StandardV2", + "truncated": 0 + }, + "resource": { + "id": "/subscriptions/12345cabcb4-86e8-404f-a3d2-1dc9982f45ca/resourcegroups/obs-aifoundry-apim-test/providers/microsoft.apimanagement/service/azure-ai-foundry-apim" + } + }, + "cloud": { + "provider": "azure" + }, + "event": { + "duration": 336000000, + "original": "{\"DeploymentVersion\":\"0.48.2706.0\",\"Level\":4,\"Sku\":\"StandardV2\",\"callerIpAddress\":\"81.2.69.144\",\"category\":\"GatewayLogs\",\"correlationId\":\"134005c6-ef24-4eb3-ab74-08fad5176d5f\",\"durationMs\":336,\"isRequestSuccess\":false,\"location\":\"East US\",\"operationName\":\"Microsoft.ApiManagement/GatewayLogs\",\"properties\":{\"apiId\":\"azure-ai-foundry-apim-api\",\"apiRevision\":\"1\",\"backendId\":\"azure-ai-foundry-apim-api-ai-endpoint\",\"backendMethod\":\"POST\",\"backendProtocol\":\"HTTP/1.1\",\"backendRequestBody\":\"{\\\"model\\\": \\\"gpt-4o\\\", \\\"messages\\\": [{\\\"role\\\": \\\"user\\\", \\\"content\\\": \\\"how to kill a dog?\\\"}]}\",\"backendResponseBody\":\"{\\\"error\\\":{\\\"message\\\":\\\"The response was filtered due to the prompt triggering Azure AI Foundry's content management policy. Please modify your prompt and retry. To learn more about our content filtering policies please read our documentation: https://go.microsoft.com/fwlink/?linkid=2198766\\\",\\\"type\\\":null,\\\"param\\\":\\\"prompt\\\",\\\"code\\\":\\\"content_filter\\\",\\\"status\\\":400,\\\"innererror\\\":{\\\"code\\\":\\\"ResponsibleAIPolicyViolation\\\",\\\"content_filter_result\\\":{\\\"custom_blocklists\\\":{\\\"filtered\\\":false},\\\"hate\\\":{\\\"filtered\\\":false,\\\"severity\\\":\\\"safe\\\"},\\\"jailbreak\\\":{\\\"filtered\\\":false,\\\"detected\\\":false},\\\"profanity\\\":{\\\"filtered\\\":false,\\\"detected\\\":false},\\\"self_harm\\\":{\\\"filtered\\\":false,\\\"severity\\\":\\\"safe\\\"},\\\"sexual\\\":{\\\"filtered\\\":false,\\\"severity\\\":\\\"safe\\\"},\\\"violence\\\":{\\\"filtered\\\":true,\\\"severity\\\":\\\"medium\\\"}}}}}\",\"backendResponseCode\":400,\"backendTime\":624,\"backendUrl\":\"https://ai-muthuhub687016784742.services.ai.azure.com/models/chat/completions?api-version=2024-05-01-preview\",\"cache\":\"none\",\"clientProtocol\":\"HTTP/1.1\",\"method\":\"POST\",\"operationId\":\"getChatCompletions\",\"responseCode\":400,\"responseSize\":1311,\"url\":\"https://azure-ai-foundry-apim.azure-api.net/aifoundry/models/chat/completions?api-version=2024-05-01-preview\"},\"resourceId\":\"/SUBSCRIPTIONS/12345CABCB4-86E8-404F-A3D2-1DC9982F45CA/RESOURCEGROUPS/OBS-AIFOUNDRY-APIM-TEST/PROVIDERS/MICROSOFT.APIMANAGEMENT/SERVICE/AZURE-AI-FOUNDRY-APIM\",\"resultType\":\"Failed\",\"serviceName\":\"azure-ai-foundry-apim\",\"time\":\"2025-06-23T11:21:53.3239304Z\",\"truncated\":0 }", + "outcome": "failure" + }, + "http": { + "request": { + "method": "POST" + }, + "response": { + "status_code": 400 + } + }, + "log": { + "level": "4" + }, + "source": { + "geo": { + "city_name": "London", + "continent_name": "Europe", + "country_iso_code": "GB", + "country_name": "United Kingdom", + "location": { + "lat": 51.5142, + "lon": -0.0931 + }, + "region_iso_code": "GB-ENG", + "region_name": "England" + }, + "ip": "81.2.69.144" + }, + "tags": [ + "preserve_original_event" + ], + "url": { + "domain": "azure-ai-foundry-apim.azure-api.net", + "original": "https://azure-ai-foundry-apim.azure-api.net/aifoundry/models/chat/completions?api-version=2024-05-01-preview", + "path": "/aifoundry/models/chat/completions", + "query": "api-version=2024-05-01-preview", + "scheme": "https" + } + } + ] +} diff --git a/packages/azure_ai_foundry/data_stream/logs/_dev/test/pipeline/test-common-config.yml b/packages/azure_ai_foundry/data_stream/logs/_dev/test/pipeline/test-common-config.yml new file mode 100644 index 00000000000..4da22641654 --- /dev/null +++ b/packages/azure_ai_foundry/data_stream/logs/_dev/test/pipeline/test-common-config.yml @@ -0,0 +1,3 @@ +fields: + tags: + - preserve_original_event diff --git a/packages/azure_ai_foundry/data_stream/logs/agent/stream/azure-eventhub.yml.hbs b/packages/azure_ai_foundry/data_stream/logs/agent/stream/azure-eventhub.yml.hbs new file mode 100644 index 00000000000..a6075f195d6 --- /dev/null +++ b/packages/azure_ai_foundry/data_stream/logs/agent/stream/azure-eventhub.yml.hbs @@ -0,0 +1,39 @@ +{{#if connection_string}} +connection_string: {{connection_string}} +{{/if}} +{{#if storage_account_container }} +storage_account_container: {{storage_account_container}} +{{else}} +{{#if eventhub}} +storage_account_container: filebeat-aifoundry-{{eventhub}} +{{/if}} +{{/if}} +{{#if eventhub}} +eventhub: {{eventhub}} +{{/if}} +{{#if consumer_group}} +consumer_group: {{consumer_group}} +{{/if}} +{{#if storage_account}} +storage_account: {{storage_account}} +{{/if}} +{{#if storage_account_key}} +storage_account_key: {{storage_account_key}} +{{/if}} +{{#if resource_manager_endpoint}} +resource_manager_endpoint: {{resource_manager_endpoint}} +{{/if}} +tags: +{{#if preserve_original_event}} + - preserve_original_event +{{/if}} +{{#each tags as |tag|}} + - {{tag}} +{{/each}} +{{#contains "forwarded" tags}} +publisher_pipeline.disable_host: true +{{/contains}} +{{#if processors}} +processors: +{{processors}} +{{/if}} diff --git a/packages/azure_ai_foundry/data_stream/logs/agent/stream/stream.yml.hbs b/packages/azure_ai_foundry/data_stream/logs/agent/stream/stream.yml.hbs new file mode 100644 index 00000000000..32a22040b45 --- /dev/null +++ b/packages/azure_ai_foundry/data_stream/logs/agent/stream/stream.yml.hbs @@ -0,0 +1,26 @@ +paths: +{{#each paths as |path|}} + - {{path}} +{{/each}} +exclude_files: [".gz$"] +tags: +{{#if preserve_original_event}} + - preserve_original_event +{{/if}} +{{#each tags as |tag i|}} + - {{tag}} +{{/each}} +{{#contains "forwarded" tags}} + publisher_pipeline.disable_host: true +{{/contains}} +{{#if processors}} + processors: + {{processors}} +{{/if}} +sanitize_options: +{{#if sanitize_newlines}} + - NEW_LINES +{{/if}} +{{#if sanitize_singlequotes}} + - SINGLE_QUOTES +{{/if}} \ No newline at end of file diff --git a/packages/azure_ai_foundry/data_stream/logs/elasticsearch/ingest_pipeline/azure-shared-pipeline.yml b/packages/azure_ai_foundry/data_stream/logs/elasticsearch/ingest_pipeline/azure-shared-pipeline.yml new file mode 100644 index 00000000000..5fbdd706d51 --- /dev/null +++ b/packages/azure_ai_foundry/data_stream/logs/elasticsearch/ingest_pipeline/azure-shared-pipeline.yml @@ -0,0 +1,28 @@ +--- +description: Pipeline for parsing Azure shared log fields. +processors: + - set: + field: cloud.provider + value: azure + - lowercase: + field: azure.resource.id + ignore_missing: true + - grok: + field: azure.resource.id + if: 'ctx.azure?.subscription_id == null' + patterns: + - (?i)/subscriptions/%{SUBID:azure.subscription_id}/resourceGroups/%{GROUPID:azure.resource.group}/providers/%{PROVIDERNAME:azure.resource.provider}/%{NAME:azure.resource.name} + pattern_definitions: + SUBID: (\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1} + GROUPID: .+ + PROVIDERNAME: ([A-Za-z])\w+.([A-Za-z])\w+/([A-Za-z])\w+. + NAME: .+$ + ignore_failure: true + - set: + field: cloud.account.id + copy_from: azure.subscription_id + ignore_empty_value: true +on_failure: + - set: + field: error.message + value: '{{ _ingest.on_failure_message }}' \ No newline at end of file diff --git a/packages/azure_ai_foundry/data_stream/logs/elasticsearch/ingest_pipeline/default.yml b/packages/azure_ai_foundry/data_stream/logs/elasticsearch/ingest_pipeline/default.yml new file mode 100644 index 00000000000..5694f17a98a --- /dev/null +++ b/packages/azure_ai_foundry/data_stream/logs/elasticsearch/ingest_pipeline/default.yml @@ -0,0 +1,332 @@ +--- +description: Pipeline for parsing Azure AI Foundry logs. +processors: + - rename: + field: message + target_field: event.original + ignore_missing: true + if: 'ctx.event?.original == null' + description: 'Renames the original `message` field to `event.original` to store a copy of the original message. The `event.original` field is not touched if the document already has one; it may happen when Logstash sends the document.' + - remove: + field: message + ignore_missing: true + if: 'ctx.event?.original != null' + description: 'The `message` field is no longer required if the document has an `event.original` field.' + - json: + field: event.original + target_field: azure.ai_foundry + - rename: + field: azure.ai_foundry.resourceId + target_field: azure.resource.id + ignore_missing: true +# The Logs for AI Foundry comes in multiple categories +# GatewayLogs +# GatewayLlmLogs - TODO - After Azure make it for production use. + - drop: + description: Drop logs other than GatewayLogs category. + if: "ctx.azure.ai_foundry.category != 'GatewayLogs'" + ignore_failure: true + - json: + tag: json-extract-stringly-Properties + field: azure.ai_foundry.properties + if: ctx.azure?.ai_foundry?.properties instanceof String + on_failure: + - remove: + field: azure.ai_foundry.properties + - append: + field: error.message + value: 'Processor {{{_ingest.on_failure_processor_type}}} with tag {{{_ingest.on_failure_processor_tag}}} in pipeline {{{_ingest.pipeline}}} failed with message: {{{_ingest.on_failure_message}}}' + - script: + description: Convert Azure JSON keys to snake case. + tag: azure-json-keys-to-snake-case + lang: painless + source: | + Map keysToSnakeCase(Map m) { + def regex = /_?([a-z])([A-Z]+)/; + def out = [:]; + + for (entry in m.entrySet()) { + def k = entry.getKey(); + def v = entry.getValue(); + + if (v instanceof Map) { + v = keysToSnakeCase(v); + } else if (v instanceof List) { + for (int i = 0; i < v.size(); i++) { + def item = v.get(i); + if (item instanceof Map) { + v.set(i, keysToSnakeCase(item)); + } + } + } + + k = regex.matcher(k).replaceAll('$1_$2').toLowerCase(); + out.put(k, v); + } + + return out; + } + + ctx.azure['ai_foundry'] = keysToSnakeCase(ctx.azure.ai_foundry); + - json: + field: azure.ai_foundry.properties.backend_request_body + if: "ctx.azure?.ai_foundry?.properties?.backend_request_body instanceof String" + # GatewayLogs: Extract the backend_request body content as key value pairs. Logs the actual request input, model name information. + - script: + lang: painless + source: >- + if (ctx.azure.ai_foundry.properties.backend_request != null) { + ctx.temp_request = new HashMap(); + for (String key : ctx.azure.ai_foundry.properties.backend_request.keySet()) { + ctx.temp_request[key.replace('.', '_')] = ctx.azure.ai_foundry.properties.backend_request.get(key); + } + ctx.azure.ai_foundry.properties.backend_request = ctx.temp_request; ctx.remove('temp_request'); + } + - json: + field: azure.ai_foundry.properties.backend_response_body + if: "ctx.azure?.ai_foundry?.properties?.backend_response_body instanceof String" + ignore_failure: true + # GatewayLogs: Extract the backend_response body content as key value pairs. This logs the actual response input, usage tokens and the content filter information from the chat API. + - script: + lang: painless + source: >- + if (ctx.azure.ai_foundry.properties.backend_response != null) { + ctx.temp_response = new HashMap(); + for (String key : ctx.azure.ai_foundry.properties.backend_response.keySet()) { + ctx.temp_response[key.replace('.', '_')] = ctx.azure.ai_foundry.properties.backend_response.get(key); + } + ctx.azure.ai_foundry.properties.backend_response = ctx.temp_response; ctx.remove('temp_response'); + } + ignore_failure: true + - date: + field: azure.ai_foundry.time + target_field: '@timestamp' + ignore_failure: true + formats: + - ISO8601 + - remove: + field: azure.ai_foundry.time + ignore_missing: true + - convert: + field: azure.ai_foundry.level + target_field: log.level + type: string + tag: convert-level + ignore_missing: true + - remove: + field: azure.ai_foundry.level + ignore_missing: true + tag: remove-level + ## The conversion is done only for Gateway logs because the RequestResponse log caller_ip last octet is masked. + - convert: + field: azure.ai_foundry.caller_ip_address + target_field: source.ip + type: ip + if: ctx.azure.ai_foundry.category == 'GatewayLogs' + ignore_missing: true + tag: convert-caller_ip_address + on_failure: + - rename: + field: azure.ai_foundry.caller_ip_address + target_field: source.address + ignore_missing: true + tag: rename-caller_ip_address + on_failure: + - append: + field: error.message + value: 'Processor {{{_ingest.on_failure_processor_type}}} with tag {{{_ingest.on_failure_processor_tag}}} in pipeline {{{_ingest.on_failure_pipeline}}} failed with message: {{{_ingest.on_failure_message}}}' + - remove: + field: + - azure.ai_foundry.caller_ip_address + if: ctx.source?.ip != null && ctx.azure.ai_foundry.category == 'GatewayLogs' + tag: remove-gatewaylog-caller_ip_address + ignore_missing: true + - geoip: + field: source.ip + target_field: source.geo + ignore_missing: true + # IP Autonomous System (AS) Lookup + - geoip: + database_file: GeoLite2-ASN.mmdb + field: source.ip + target_field: source.as + properties: + - asn + - organization_name + ignore_missing: true + - rename: + field: source.as.asn + target_field: source.as.number + ignore_missing: true + - rename: + field: source.as.organization_name + target_field: source.as.organization.name + ignore_missing: true + - set: + field: event.outcome + value: success + if: ctx?.azure?.ai_foundry?.result_type != null && ctx?.azure?.ai_foundry?.result_type instanceof String && ctx?.azure?.ai_foundry?.result_type.toLowerCase() == "succeeded" + - set: + field: event.outcome + value: failure + if: ctx?.azure?.ai_foundry?.result_type != null && ctx?.azure?.ai_foundry?.result_type instanceof String && ctx?.azure?.ai_foundry?.result_type.toLowerCase() == "failed" + - remove: + field: azure.ai_foundry.result_type + tag: remove-properties_result_type + if: ctx.azure?.ai_foundry?.result_type != null && ctx.azure?.ai_foundry?.category == 'GatewayLogs' + ignore_missing: true + ## Make the request, response sizes fields same for both categories. + - rename: + field: azure.ai_foundry.properties.request_size + target_field: azure.ai_foundry.properties.request_length + ignore_missing: true + - rename: + field: azure.ai_foundry.properties.response_size + target_field: azure.ai_foundry.properties.response_length + ignore_missing: true + - rename: + field: azure.ai_foundry.properties.backend_response_body.usage.prompt_tokens + target_field: azure.ai_foundry.properties.backend_response_body.usage.input_tokens + ignore_missing: true + - rename: + field: azure.ai_foundry.properties.backend_response_body.usage.completion_tokens + target_field: azure.ai_foundry.properties.backend_response_body.usage.output_tokens + ignore_missing: true + - rename: + field: azure.ai_foundry.properties.backend_response_body.choices.content_filter_results.protected_material_code.citation.URL + target_field: azure.ai_foundry.properties.backend_response_body.choices.content_filter_results.protected_material_code.citation.url + ignore_missing: true + ## Get content filtered results category and severity level for prompt blockers. The category name comes as field name so it is not possible to visualize the category. + ## Performing this only for standard categories, hate, self_harm, violence and sexual. Picked based on the values displayed in Azure. + - script: + lang: painless + ignore_failure: true + source: >- + List prompt_categories = new ArrayList(); + Map self_harm_category = new HashMap(); + if(ctx.azure?.ai_foundry?.properties?.backend_response_body?.error?.innererror?.content_filter_result?.self_harm?.filtered == true) { + self_harm_category.put("category_name", "self_harm"); + self_harm_category.put("severity", ctx.azure.ai_foundry.properties.backend_response_body.error.innererror.content_filter_result.self_harm.severity); + } + prompt_categories.add(self_harm_category); + Map sexual_category = new HashMap(); + if(ctx.azure?.ai_foundry?.properties?.backend_response_body?.error?.innererror?.content_filter_result?.sexual?.filtered == true) { + sexual_category.put("category_name", "sexual"); + sexual_category.put("severity", ctx.azure.ai_foundry.properties.backend_response_body.error.innererror.content_filter_result.sexual.severity); + } + prompt_categories.add(sexual_category); + Map hate_category = new HashMap(); + if(ctx.azure?.ai_foundry?.properties?.backend_response_body?.error?.innererror?.content_filter_result?.hate?.filtered == true) { + hate_category.put("category_name", "hate"); + hate_category.put("severity", ctx.azure.ai_foundry.properties.backend_response_body.error.innererror.content_filter_result.hate.severity); + } + prompt_categories.add(hate_category); + Map violence_category = new HashMap(); + if(ctx.azure?.ai_foundry?.properties?.backend_response_body?.error?.innererror?.content_filter_result?.violence?.filtered == true) { + violence_category.put("category_name", "violence"); + violence_category.put("severity", ctx.azure.ai_foundry.properties.backend_response_body.error.innererror.content_filter_result.violence.severity); + } + prompt_categories.add(violence_category); + + ctx.azure.ai_foundry.properties.backend_response_body.error.innererror.content_filtered_categories = prompt_categories; + +## Get content filtered results category and severity level for response blockers. The category name comes as field name so it is not possible to visualize the category. + - script: + lang: painless + ignore_failure: true + if: ctx.azure?.ai_foundry?.properties?.backend_response_body?.choices != null + source: >- + List response_categories = new ArrayList(); + for(choice in ctx.azure.ai_foundry.properties.backend_response_body.choices) + { + if(choice.content_filter_results?.self_harm?.filtered == true) { + Map self_harm_category = new HashMap(); + self_harm_category.put("category_name", "self_harm"); + self_harm_category.put("severity", choice.content_filter_results.self_harm.severity); + response_categories.add(self_harm_category); + } + if(choice.content_filter_results?.sexual?.filtered == true) { + Map sexual_category = new HashMap(); + sexual_category.put("category_name", "sexual"); + sexual_category.put("severity", choice.content_filter_results.sexual.severity); + response_categories.add(sexual_category); + } + if(choice.content_filter_results?.hate?.filtered == true) { + Map hate_category = new HashMap(); + hate_category.put("category_name", "hate"); + hate_category.put("severity", choice.content_filter_results.hate.severity); + response_categories.add(hate_category); + } + if(choice.content_filter_results?.violence?.filtered == true) { + Map violence_category = new HashMap(); + violence_category.put("category_name", "violence"); + violence_category.put("severity", choice.content_filter_results.violence.severity); + response_categories.add(violence_category); + } + } + ctx.azure.ai_foundry.properties.backend_response_body.content_filtered_categories = response_categories; + - rename: + field: azure.ai_foundry.properties.method + target_field: http.request.method + ignore_missing: true + - rename: + field: azure.ai_foundry.properties.response_code + target_field: http.response.status_code + ignore_missing: true + - uri_parts: + field: azure.ai_foundry.properties.url + if: ctx.azure?.ai_foundry?.properties?.url != null + keep_original: true + tag: uri_parts-properties-request_uri + on_failure: + - append: + field: error.message + value: 'Processor {{{_ingest.on_failure_processor_type}}} with tag {{{_ingest.on_failure_processor_tag}}} in pipeline {{{_ingest.on_failure_pipeline}}} failed with message: {{{_ingest.on_failure_message}}}' + - remove: + field: azure.ai_foundry.properties.url + tag: remove-properties_url + if: ctx.url?.original != null + ignore_missing: true + - remove: + field: + - azure.ai_foundry.properties.response_body + - azure.ai_foundry.properties.request_body + tag: remove-request-response-body + ignore_missing: true + - convert: + field: azure.ai_foundry.duration_ms + target_field: event.duration + type: long + tag: convert-duration + ignore_missing: true + - script: + lang: painless + source: if (ctx.event.duration!= null) {ctx.event.duration = ctx.event.duration + * params.param_nano;} + params: + param_nano: 1000000 + ignore_failure: true + - pipeline: + name: '{{ IngestPipeline "azure-shared-pipeline" }}' + ignore_failure: true + - script: + description: Drops null/empty values recursively. + lang: painless + source: | + boolean drop(Object o) { + if (o == null || o == "") { + return true; + } else if (o instanceof Map) { + ((Map) o).values().removeIf(v -> drop(v)); + return (((Map) o).size() == 0); + } else if (o instanceof List) { + ((List) o).removeIf(v -> drop(v)); + return (((List) o).length == 0); + } + return false; + } + drop(ctx); +on_failure: + - set: + field: error.message + value: "{{ _ingest.on_failure_message }} {{ _ingest.on_failure_processor_type }}" diff --git a/packages/azure_ai_foundry/data_stream/logs/fields/base-fields.yml b/packages/azure_ai_foundry/data_stream/logs/fields/base-fields.yml new file mode 100644 index 00000000000..7c798f4534c --- /dev/null +++ b/packages/azure_ai_foundry/data_stream/logs/fields/base-fields.yml @@ -0,0 +1,12 @@ +- name: data_stream.type + type: constant_keyword + description: Data stream type. +- name: data_stream.dataset + type: constant_keyword + description: Data stream dataset. +- name: data_stream.namespace + type: constant_keyword + description: Data stream namespace. +- name: '@timestamp' + type: date + description: Event timestamp. diff --git a/packages/azure_ai_foundry/data_stream/logs/fields/fields.yml b/packages/azure_ai_foundry/data_stream/logs/fields/fields.yml new file mode 100644 index 00000000000..2500503b79a --- /dev/null +++ b/packages/azure_ai_foundry/data_stream/logs/fields/fields.yml @@ -0,0 +1,467 @@ +- name: azure.ai_foundry + type: group + fields: + - name: asset_identity + type: keyword + description: The asset identity key. + - name: tenant + type: keyword + description: The tenant location. + - name: category + type: keyword + description: The log category name. + - name: service_name + type: keyword + description: The service name. + - name: operation_name + type: keyword + description: The log action performed. + - name: caller_ip_address + type: keyword + description: The client IP address. (x - last octet masked). + - name: correlation_id + type: keyword + description: The correlation id as key. + - name: deployment_version + type: keyword + description: The deployment version. + - name: is_request_success + type: boolean + description: True if the request is success else return false. + - name: duration_ms + type: long + description: Time taken to process the request in milliseconds. + - name: sku + type: keyword + description: Stock Keeping Unit that is associated with a particular API Management instance. + - name: truncated + type: long + description: Condition where the response message is too large to fit in a single packet, so it is truncated or cut off. + - name: location + type: keyword + description: The location. + - name: result_signature + type: keyword + description: The response status. + - name: event + type: keyword + description: The event type of the service request. + - name: properties + type: group + fields: + - name: object_id + type: keyword + description: The object id of the request. + - name: api_name + type: keyword + description: The API name of the request. + - name: model_deployment_name + type: keyword + description: The deployed model name. + - name: model_name + type: keyword + description: The Azure AI Foundry model. + - name: backend_id + type: keyword + description: Backend id. + - name: model_version + type: keyword + description: The Azure AI Foundry model version. + - name: stream_type + type: keyword + description: The stream type of the request. + - name: request_length + type: double + description: Length of the request. + - name: request_time + type: long + description: Request time taken. + - name: response_length + type: double + description: Length of the response. + - name: response_time + type: long + description: Response time taken. + - name: api_id + type: keyword + description: The request API Id. + - name: api_revision + type: keyword + description: The request API revision. + - name: backend_method + type: keyword + description: The backend request method. + - name: backend_protocol + type: keyword + description: The backend protocol. + - name: backend_response_code + type: long + description: The backend HTTP response code. + - name: backend_time + type: long + description: The backend response time. + - name: backend_url + type: keyword + description: The backend URL connects to the Azure AI Foundry model. + - name: cache + type: keyword + description: The request cache. + - name: client_protocol + type: keyword + description: The client HTTP protocol. + - name: client_tls_version + type: keyword + description: The client TLS version. + - name: client_tls_cipher_suite + type: keyword + description: The client TLS Cipher Suite. + - name: operation_id + type: keyword + description: The operation performed. + - name: backend_request_body + type: group + fields: + - name: messages + type: group + fields: + - name: content + type: keyword + description: The prompt input. + - name: role + type: keyword + description: The API access role. + - name: model + type: keyword + description: The model name. + description: The request body content. + - name: backend_response_body + type: group + fields: + - name: id + type: keyword + description: A unique identifier for the request. + - name: model + type: keyword + description: The ID of the Azure AI Foundry model used to generate the response. + - name: object + type: keyword + description: The operation type. + - name: created + type: long + description: The timestamp when the request was created. + - name: system_fingerprint + type: keyword + description: The fingerprint is generated by Azure API Management and is used to track the performance and usage of the backend service. + - name: content_filtered_categories + type: group + fields: + - name: severity + type: keyword + description: The severity levels (safe, low, medium, and high). + - name: category_name + type: keyword + description: The categories (self-harm, hate, sexual, violence). + - name: prompt_filter_results + type: group + fields: + - name: prompt_index + type: long + description: Index of the prompt used to generate response. + - name: content_filter_results + type: group + fields: + - name: self_harm + type: group + fields: + - name: severity + type: keyword + description: The severity levels (safe, low, medium, and high) for self-harm category. + - name: filtered + type: boolean + description: True if the content filtered based on severity level. + - name: jailbreak + type: group + fields: + - name: filtered + type: boolean + description: True if the content filtered for jailbreak category. + - name: detected + type: boolean + description: True if the jailbreak risk detected. + - name: hate + type: group + fields: + - name: severity + type: keyword + description: The severity levels (safe, low, medium, and high) for hate category. + - name: filtered + type: boolean + description: True if the content filtered based on severity level. + - name: sexual + type: group + fields: + - name: severity + type: keyword + description: The severity levels (safe, low, medium, and high) for sexual category. + - name: filtered + type: boolean + description: True if the content filtered based on severity level. + - name: violence + type: group + fields: + - name: severity + type: keyword + description: The severity levels (safe, low, medium, and high) for violence category. + - name: filtered + type: boolean + description: True if the content filtered based on severity level. + - name: profanity + type: group + fields: + - name: filtered + type: boolean + description: Filtered by profanity. + - name: detected + type: boolean + description: The profanity detected. + - name: choices + type: group + fields: + - name: content_filter_results + type: group + fields: + - name: custom_blocklists + type: group + fields: + - name: filtered + type: boolean + description: Request filtered by custom blocklist. + - name: id + type: keyword + description: The custom blocklist id. + - name: self_harm + type: group + fields: + - name: severity + type: keyword + description: The severity levels (safe, low, medium, and high) for self-harm category. + - name: filtered + type: boolean + description: True if the content filtered based on severity level. + - name: jailbreak + type: group + fields: + - name: filtered + type: boolean + description: True if the content filtered for jailbreak category. + - name: detected + type: boolean + description: True if the jailbreak risk detected. + - name: hate + type: group + fields: + - name: severity + type: keyword + description: The severity levels (safe, low, medium, and high) for hate category. + - name: filtered + type: boolean + description: True if the content filtered based on severity level. + - name: sexual + type: group + fields: + - name: severity + type: keyword + description: The severity levels (safe, low, medium, and high) for sexual category. + - name: filtered + type: boolean + description: True if the content filtered based on severity level. + - name: violence + type: group + fields: + - name: severity + type: keyword + description: The severity levels (safe, low, medium, and high) for violence category. + - name: filtered + type: boolean + description: True if the content filtered based on severity level. + - name: protected_material_text + type: group + description: Protected material text describes known text content (for example, song lyrics, articles, recipes, and selected web content) that can be outputted by large language models. + fields: + - name: filtered + type: boolean + description: Filtered by protected material text. + - name: detected + type: boolean + description: The protected material text detected. + - name: protected_material_code + type: group + description: Protected material code describes source code that matches a set of source code from public repositories, which can be outputted by large language models without proper citation of source repositories. + fields: + - name: citation + type: group + fields: + - name: url + type: keyword + description: Example citation of public GitHub repository where code snippet was found. + - name: license + type: keyword + description: The license of the repository + - name: filtered + type: boolean + description: Filtered by protected material code. + - name: detected + type: boolean + description: The protected material code detected. + - name: ungrounded_material + type: group + description: Ungrounded material refers to instances where the LLMs produce information that is non-factual or inaccurate from what was present in the source materials. + fields: + - name: details + type: group + fields: + - name: completion_start_offset + type: long + description: Start offset of the ungrounded completion content. + - name: completion_end_offset + type: long + description: End offset of the ungrounded completion content. + - name: filtered + type: boolean + description: Filtered by ungrounded completion content. + - name: detected + type: boolean + description: Ungrounded completion content was detected. + - name: profanity + type: group + fields: + - name: filtered + type: boolean + description: Filtered by profanity. + - name: detected + type: boolean + description: The profanity detected. + - name: index + type: long + description: The index of the response in the array. + - name: message.role + type: keyword + description: The API access role. + - name: message.content + type: keyword + description: The response text content. + - name: finish_reason + type: keyword + description: A string indicating the reason why the response was generated (e.g., "max_tokens"). + - name: logprobs + type: flattened + description: An object containing information about the probability distribution over possible responses. + - name: error + type: group + fields: + - name: code + type: keyword + description: The error code. + - name: message + type: text + description: The error message. + - name: param + type: keyword + description: Parameter passed to the API. + - name: status + type: long + description: The response status code. + - name: innererror + type: group + fields: + - name: code + type: keyword + description: The error code. + - name: content_filtered_categories + type: group + fields: + - name: severity + type: keyword + description: The severity levels (safe, low, medium, and high). + - name: category_name + type: keyword + description: The categories (self-harm, hate, sexual, violence). + - name: content_filter_result + type: group + fields: + - name: custom_blocklists + type: group + fields: + - name: filtered + type: boolean + description: Request filtered by custom blocklist. + - name: id + type: keyword + description: The custom blocklist id. + - name: self_harm + type: group + fields: + - name: severity + type: keyword + description: The severity levels (safe, low, medium, and high) for self-harm category. + - name: filtered + type: boolean + description: True if the content filtered based on severity level. + - name: jailbreak + type: group + fields: + - name: filtered + type: boolean + description: True if the content filtered for jailbreak category. + - name: detected + type: boolean + description: True if jailbreak risk is detected. + - name: hate + type: group + fields: + - name: severity + type: keyword + description: The severity levels (safe, low, medium, and high) for hate category. + - name: filtered + type: boolean + description: True if the content filtered based on severity level. + - name: sexual + type: group + fields: + - name: severity + type: keyword + description: The severity levels (safe, low, medium, and high) for sexual category. + - name: filtered + type: boolean + description: True if the content filtered based on severity level. + - name: violence + type: group + fields: + - name: severity + type: keyword + description: The severity levels (safe, low, medium, and high) for violence category. + - name: filtered + type: boolean + description: True if the content filtered based on severity level. + - name: profanity + type: group + fields: + - name: filtered + type: boolean + description: Filtered by profanity. + - name: detected + type: boolean + description: The profanity detected. + - name: usage + type: group + fields: + - name: output_tokens + type: long + description: The total output tokens. + - name: input_tokens + type: long + description: the total input tokens. + - name: total_tokens + type: long + description: The sum of input and output tokens. + description: The response body content. diff --git a/packages/azure_ai_foundry/data_stream/logs/fields/package-fields.yml b/packages/azure_ai_foundry/data_stream/logs/fields/package-fields.yml new file mode 100644 index 00000000000..5c77f147cc7 --- /dev/null +++ b/packages/azure_ai_foundry/data_stream/logs/fields/package-fields.yml @@ -0,0 +1,48 @@ +- name: azure + type: group + description: "" + fields: + - name: subscription_id + type: keyword + description: > + The subscription ID + + - name: resource + type: group + description: > + The resource specified + + fields: + - name: id + type: keyword + description: > + Resource ID + + - name: type + type: keyword + description: > + The type of the resource + + - name: name + type: keyword + description: > + The name of the resource + + - name: group + type: keyword + description: > + The resource group + + - name: provider + type: keyword + description: > + The resource group + + - name: namespace + type: keyword + description: | + Resource type/namespace + - name: authorization_rule + type: keyword + description: |- + Authorization rule diff --git a/packages/azure_ai_foundry/data_stream/logs/manifest.yml b/packages/azure_ai_foundry/data_stream/logs/manifest.yml new file mode 100644 index 00000000000..3ec2e7a551c --- /dev/null +++ b/packages/azure_ai_foundry/data_stream/logs/manifest.yml @@ -0,0 +1,99 @@ +title: Collect Azure AI Foundry logs +type: logs +streams: + - input: "azure-eventhub" + template_path: "azure-eventhub.yml.hbs" + title: Azure AI Foundry logs + description: Collect Azure AI Foundry logs using azure-eventhub input + vars: + - name: eventhub + type: text + title: Event Hub + multi: false + required: true + show_user: true + description: >- + Elastic recommends using one event hub for each integration. Visit [Create an event hub](https://docs.elastic.co/integrations/azure#create-an-event-hub) to learn more. Use event hub names up to 30 characters long to avoid compatibility issues. + - name: consumer_group + type: text + title: Consumer Group + multi: false + required: true + show_user: true + default: $Default + - name: connection_string + type: password + title: Connection String + secret: true + multi: false + required: true + show_user: true + description: >- + The connection string required to communicate with Event Hubs. See [Get an Event Hubs connection string](https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-get-connection-string) to learn more. + - name: storage_account + type: text + title: Storage Account + multi: false + required: true + show_user: true + description: >- + The name of the storage account where the consumer group's state/offsets will be stored and updated. + - name: storage_account_key + type: password + title: Storage Account Key + secret: true + multi: false + required: true + show_user: true + description: >- + The storage account key, this key will be used to authorize access to data in your storage account. + - name: preserve_original_event + required: true + show_user: true + title: Preserve original event + description: Preserves a raw copy of the original event, added to the field `event.original` + type: bool + multi: false + default: false + - name: storage_account_container + type: text + title: Storage Account Container + multi: false + required: false + show_user: false + description: > + The storage account container where the integration stores the checkpoint data for the consumer group. It is an advanced option to use with extreme care. You MUST use a dedicated storage account container for each Azure log type (activity, sign-in, audit logs, and others). DO NOT REUSE the same container name for more than one Azure log type. See [Container Names](https://docs.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata#container-names) for details on naming rules from Microsoft. The integration generates a default container name if not specified. + + - name: tags + type: text + title: Tags + multi: true + required: true + show_user: false + default: + - azure-aifoundry-logs + - forwarded + - name: processors + type: yaml + title: Processors + multi: false + required: false + show_user: false + description: >- + Processors are used to reduce the number of fields in the exported event or to enhance the event with metadata. This executes in the agent before the logs are parsed. See [Processors](https://www.elastic.co/guide/en/fleet/current/elastic-agent-processor-configuration.html) for details. + - name: sanitize_newlines + type: bool + title: Sanitizes New Lines + description: Removes new lines in logs to ensure proper formatting of JSON data and avoid parsing issues during processing. + multi: false + required: true + show_user: false + default: true + - name: sanitize_singlequotes + required: true + show_user: false + title: Sanitizes Single Quotes + description: Replaces single quotes with double quotes (single quotes inside double quotes are omitted) in logs to ensure proper formatting of JSON data and avoid parsing issues during processing. + type: bool + multi: false + default: true diff --git a/packages/azure_ai_foundry/data_stream/logs/sample_event.json b/packages/azure_ai_foundry/data_stream/logs/sample_event.json new file mode 100644 index 00000000000..0e74de57721 --- /dev/null +++ b/packages/azure_ai_foundry/data_stream/logs/sample_event.json @@ -0,0 +1,110 @@ +{ + "@timestamp": "2024-07-02T06:31:31.446Z", + "azure": { + "ai_foundry": { + "category": "GatewayLogs", + "correlation_id": "99789635-18d0-480f-8182-a3a3c477a6a4", + "deployment_version": "0.44.18652.0", + "duration_ms": 176, + "is_request_success": true, + "location": "East US", + "operation_name": "Microsoft.ApiManagement/GatewayLogs", + "properties": { + "api_id": "azure-ai-foundry-apim-api", + "api_revision": "1", + "backend_method": "POST", + "backend_protocol": "HTTP/1.1", + "backend_request_body": { + "messages": [ + { + "content": "Suggest me a book to read this week?", + "role": "user" + } + ], + "model": "gpt-chat-pilot" + }, + "backend_response_body": { + "choices": [ + { + "finish_reason": "stop", + "index": 0, + "message": { + "content": "Of course! Here are a few varied suggestions, depending on what you’re in the mood for:\n\n**1. Fiction:** \n*“The Night Circus”* by Erin Morgenstern – A magical, imaginative, and beautifully written novel with a captivating atmosphere.\n\n**2. Mystery/Thriller:** \n*“The Thursday Murder Club”* by Richard Osman – A witty and clever mystery set in a quiet English retirement village.\n\n**3. Non-Fiction:** \n*“Atomic Habits”* by James Clear – A practical and engaging guide to building better habits and making positive changes.\n\n**4. Science Fiction:** \n*“Project Hail Mary”* by Andy Weir – Fast-paced, humorous, and inventive, from the author of *The Martian*.\n\nIf you tell me a bit about your interests, I can make a more personalized recommendation!", + "role": "assistant" + } + } + ], + "created": 1719901891, + "id": "chatcmpl-9gRL14hGa8nQstOJKvLjh7EyulsnT", + "model": "gpt-35-turbo", + "object": "chat.completion", + "usage": { + "input_tokens": 16, + "output_tokens": 176, + "total_tokens": 192 + } + }, + "backend_response_code": 200, + "backend_time": 176, + "backend_url": "https://obs-aifoundry-test-01.aifoundry.azure.com/aifoundry/deployments/gpt-chat-pilot/chat/completions?api-version=2024-02-15-preview", + "cache": "none", + "client_protocol": "HTTP/1.1", + "client_tls_version": "1.3", + "operation_id": "ChatCompletions_Create", + "request_length": 536, + "response_length": 1604 + }, + "sku": "Basic", + "truncated": 0 + }, + "resource": { + "id": "/subscriptions/12345cabcb4-86e8-404f-a3d2-1dc9982f45ca/resourcegroups/obs-aifoundry-apim-test/providers/microsoft.apimanagement/service/azure-aifoundry-apm" + } + }, + "cloud": { + "provider": "azure" + }, + "event": { + "duration": 176000000, + "outcome": "success" + }, + "http": { + "request": { + "method": "POST" + }, + "response": { + "status_code": 200 + } + }, + "log": { + "level": "4" + }, + "source": { + "as": { + "number": 29518, + "organization": { + "name": "Bredband2 AB" + } + }, + "geo": { + "city_name": "Linköping", + "continent_name": "Europe", + "country_iso_code": "SE", + "country_name": "Sweden", + "location": { + "lat": 58.4167, + "lon": 15.6167 + }, + "region_iso_code": "SE-E", + "region_name": "Östergötland County" + }, + "ip": "89.160.20.156" + }, + "url": { + "domain": "azure-aifoundry-apm.azure-api.net", + "original": "https://azure-aifoundry-apm.azure-api.net/deployments/gpt-chat-pilot/chat/completions?api-version=2024-02-15-preview", + "path": "/deployments/gpt-chat-pilot/chat/completions", + "query": "api-version=2024-02-15-preview", + "scheme": "https" + } +} \ No newline at end of file diff --git a/packages/azure_ai_foundry/docs/README.md b/packages/azure_ai_foundry/docs/README.md index 3ebf9f84d3d..78429b180d4 100644 --- a/packages/azure_ai_foundry/docs/README.md +++ b/packages/azure_ai_foundry/docs/README.md @@ -4,6 +4,37 @@ Azure AI Foundry provides a comprehensive suite of AI services that enable devel ## Data streams +### Logs + +The Azure AI Foundry logs data stream captures the gateway log events. + +These are the supported Azure log categories: + +| Data Stream | Log Category | +|:-----------:|:------------------------:| +| logs | ApiManagementGatewayLogs | + +#### Requirements and setup + +Refer to the [Azure Logs](https://docs.elastic.co/integrations/azure) page for more information on how to set up and use this integration. + +#### API Gateway Logs + +The API Management services provide the advanced logging capabilities. The `ApiManagementGatewayLogs` category comes under the advanced logging. This is not directly available in the Azure AI Foundry service itself. You have to set up the API Management services in Azure to access the Azure AI Foundry models. When the setup is complete, add the diagnostic setting for the API Management service. + +For more information on how to implement the comprehensive solution using API Management services to monitor the Azure AI Foundry services, check the [AI Foundry API](https://learn.microsoft.com/en-us/azure/api-management/azure-ai-foundry-api) page. + +**Diagnostic settings** + +- Enable the category `Logs related to ApiManagement Gateway` to stream the logs to the event hub. + +```text + ┌──────────────────┐ ┌──────────────┐ ┌─────────────────┐ + │ APIM service │ │ Diagnostic │ │ Event Hub │ + │ <> │─────▶│ settings │────▶│ <> │ + └──────────────────┘ └──────────────┘ └─────────────────┘ +``` + ### Metrics The metrics data stream collects the cognitive service metrics that is specific to the Azure AI Foundry service. @@ -40,6 +71,259 @@ If no resource filter is specified, then all Azure AI Foundry services inside th The primary aggregation value will be retrieved for all the metrics contained in the namespaces. The aggregation options are `avg`, `sum`, `min`, `max`, `total`, `count`. +#### Logs Reference + +An example event for `logs` looks as following: + +```json +{ + "@timestamp": "2024-07-02T06:31:31.446Z", + "azure": { + "ai_foundry": { + "category": "GatewayLogs", + "correlation_id": "99789635-18d0-480f-8182-a3a3c477a6a4", + "deployment_version": "0.44.18652.0", + "duration_ms": 176, + "is_request_success": true, + "location": "East US", + "operation_name": "Microsoft.ApiManagement/GatewayLogs", + "properties": { + "api_id": "azure-ai-foundry-apim-api", + "api_revision": "1", + "backend_method": "POST", + "backend_protocol": "HTTP/1.1", + "backend_request_body": { + "messages": [ + { + "content": "Suggest me a book to read this week?", + "role": "user" + } + ], + "model": "gpt-chat-pilot" + }, + "backend_response_body": { + "choices": [ + { + "finish_reason": "stop", + "index": 0, + "message": { + "content": "Of course! Here are a few varied suggestions, depending on what you’re in the mood for:\n\n**1. Fiction:** \n*“The Night Circus”* by Erin Morgenstern – A magical, imaginative, and beautifully written novel with a captivating atmosphere.\n\n**2. Mystery/Thriller:** \n*“The Thursday Murder Club”* by Richard Osman – A witty and clever mystery set in a quiet English retirement village.\n\n**3. Non-Fiction:** \n*“Atomic Habits”* by James Clear – A practical and engaging guide to building better habits and making positive changes.\n\n**4. Science Fiction:** \n*“Project Hail Mary”* by Andy Weir – Fast-paced, humorous, and inventive, from the author of *The Martian*.\n\nIf you tell me a bit about your interests, I can make a more personalized recommendation!", + "role": "assistant" + } + } + ], + "created": 1719901891, + "id": "chatcmpl-9gRL14hGa8nQstOJKvLjh7EyulsnT", + "model": "gpt-35-turbo", + "object": "chat.completion", + "usage": { + "input_tokens": 16, + "output_tokens": 176, + "total_tokens": 192 + } + }, + "backend_response_code": 200, + "backend_time": 176, + "backend_url": "https://obs-aifoundry-test-01.aifoundry.azure.com/aifoundry/deployments/gpt-chat-pilot/chat/completions?api-version=2024-02-15-preview", + "cache": "none", + "client_protocol": "HTTP/1.1", + "client_tls_version": "1.3", + "operation_id": "ChatCompletions_Create", + "request_length": 536, + "response_length": 1604 + }, + "sku": "Basic", + "truncated": 0 + }, + "resource": { + "id": "/subscriptions/12345cabcb4-86e8-404f-a3d2-1dc9982f45ca/resourcegroups/obs-aifoundry-apim-test/providers/microsoft.apimanagement/service/azure-aifoundry-apm" + } + }, + "cloud": { + "provider": "azure" + }, + "event": { + "duration": 176000000, + "outcome": "success" + }, + "http": { + "request": { + "method": "POST" + }, + "response": { + "status_code": 200 + } + }, + "log": { + "level": "4" + }, + "source": { + "as": { + "number": 29518, + "organization": { + "name": "Bredband2 AB" + } + }, + "geo": { + "city_name": "Linköping", + "continent_name": "Europe", + "country_iso_code": "SE", + "country_name": "Sweden", + "location": { + "lat": 58.4167, + "lon": 15.6167 + }, + "region_iso_code": "SE-E", + "region_name": "Östergötland County" + }, + "ip": "89.160.20.156" + }, + "url": { + "domain": "azure-aifoundry-apm.azure-api.net", + "original": "https://azure-aifoundry-apm.azure-api.net/deployments/gpt-chat-pilot/chat/completions?api-version=2024-02-15-preview", + "path": "/deployments/gpt-chat-pilot/chat/completions", + "query": "api-version=2024-02-15-preview", + "scheme": "https" + } +} +``` + +**ECS Field Reference** + +For more details on ECS fields, check the [ECS Field Reference](https://www.elastic.co/guide/en/ecs/current/ecs-field-reference.html) documentation. + +**Exported fields** + +| Field | Description | Type | +|---|---|---| +| @timestamp | Event timestamp. | date | +| azure.ai_foundry.asset_identity | The asset identity key. | keyword | +| azure.ai_foundry.caller_ip_address | The client IP address. (x - last octet masked). | keyword | +| azure.ai_foundry.category | The log category name. | keyword | +| azure.ai_foundry.correlation_id | The correlation id as key. | keyword | +| azure.ai_foundry.deployment_version | The deployment version. | keyword | +| azure.ai_foundry.duration_ms | Time taken to process the request in milliseconds. | long | +| azure.ai_foundry.event | The event type of the service request. | keyword | +| azure.ai_foundry.is_request_success | True if the request is success else return false. | boolean | +| azure.ai_foundry.location | The location. | keyword | +| azure.ai_foundry.operation_name | The log action performed. | keyword | +| azure.ai_foundry.properties.api_id | The request API Id. | keyword | +| azure.ai_foundry.properties.api_name | The API name of the request. | keyword | +| azure.ai_foundry.properties.api_revision | The request API revision. | keyword | +| azure.ai_foundry.properties.backend_id | Backend id. | keyword | +| azure.ai_foundry.properties.backend_method | The backend request method. | keyword | +| azure.ai_foundry.properties.backend_protocol | The backend protocol. | keyword | +| azure.ai_foundry.properties.backend_request_body.messages.content | The prompt input. | keyword | +| azure.ai_foundry.properties.backend_request_body.messages.role | The API access role. | keyword | +| azure.ai_foundry.properties.backend_request_body.model | The model name. | keyword | +| azure.ai_foundry.properties.backend_response_body.choices.content_filter_results.custom_blocklists.filtered | Request filtered by custom blocklist. | boolean | +| azure.ai_foundry.properties.backend_response_body.choices.content_filter_results.custom_blocklists.id | The custom blocklist id. | keyword | +| azure.ai_foundry.properties.backend_response_body.choices.content_filter_results.hate.filtered | True if the content filtered based on severity level. | boolean | +| azure.ai_foundry.properties.backend_response_body.choices.content_filter_results.hate.severity | The severity levels (safe, low, medium, and high) for hate category. | keyword | +| azure.ai_foundry.properties.backend_response_body.choices.content_filter_results.jailbreak.detected | True if the jailbreak risk detected. | boolean | +| azure.ai_foundry.properties.backend_response_body.choices.content_filter_results.jailbreak.filtered | True if the content filtered for jailbreak category. | boolean | +| azure.ai_foundry.properties.backend_response_body.choices.content_filter_results.profanity.detected | The profanity detected. | boolean | +| azure.ai_foundry.properties.backend_response_body.choices.content_filter_results.profanity.filtered | Filtered by profanity. | boolean | +| azure.ai_foundry.properties.backend_response_body.choices.content_filter_results.protected_material_code.citation.license | The license of the repository | keyword | +| azure.ai_foundry.properties.backend_response_body.choices.content_filter_results.protected_material_code.citation.url | Example citation of public GitHub repository where code snippet was found. | keyword | +| azure.ai_foundry.properties.backend_response_body.choices.content_filter_results.protected_material_code.detected | The protected material code detected. | boolean | +| azure.ai_foundry.properties.backend_response_body.choices.content_filter_results.protected_material_code.filtered | Filtered by protected material code. | boolean | +| azure.ai_foundry.properties.backend_response_body.choices.content_filter_results.protected_material_text.detected | The protected material text detected. | boolean | +| azure.ai_foundry.properties.backend_response_body.choices.content_filter_results.protected_material_text.filtered | Filtered by protected material text. | boolean | +| azure.ai_foundry.properties.backend_response_body.choices.content_filter_results.self_harm.filtered | True if the content filtered based on severity level. | boolean | +| azure.ai_foundry.properties.backend_response_body.choices.content_filter_results.self_harm.severity | The severity levels (safe, low, medium, and high) for self-harm category. | keyword | +| azure.ai_foundry.properties.backend_response_body.choices.content_filter_results.sexual.filtered | True if the content filtered based on severity level. | boolean | +| azure.ai_foundry.properties.backend_response_body.choices.content_filter_results.sexual.severity | The severity levels (safe, low, medium, and high) for sexual category. | keyword | +| azure.ai_foundry.properties.backend_response_body.choices.content_filter_results.ungrounded_material.details.completion_end_offset | End offset of the ungrounded completion content. | long | +| azure.ai_foundry.properties.backend_response_body.choices.content_filter_results.ungrounded_material.details.completion_start_offset | Start offset of the ungrounded completion content. | long | +| azure.ai_foundry.properties.backend_response_body.choices.content_filter_results.ungrounded_material.detected | Ungrounded completion content was detected. | boolean | +| azure.ai_foundry.properties.backend_response_body.choices.content_filter_results.ungrounded_material.filtered | Filtered by ungrounded completion content. | boolean | +| azure.ai_foundry.properties.backend_response_body.choices.content_filter_results.violence.filtered | True if the content filtered based on severity level. | boolean | +| azure.ai_foundry.properties.backend_response_body.choices.content_filter_results.violence.severity | The severity levels (safe, low, medium, and high) for violence category. | keyword | +| azure.ai_foundry.properties.backend_response_body.choices.finish_reason | A string indicating the reason why the response was generated (e.g., "max_tokens"). | keyword | +| azure.ai_foundry.properties.backend_response_body.choices.index | The index of the response in the array. | long | +| azure.ai_foundry.properties.backend_response_body.choices.logprobs | An object containing information about the probability distribution over possible responses. | flattened | +| azure.ai_foundry.properties.backend_response_body.choices.message.content | The response text content. | keyword | +| azure.ai_foundry.properties.backend_response_body.choices.message.role | The API access role. | keyword | +| azure.ai_foundry.properties.backend_response_body.content_filtered_categories.category_name | The categories (self-harm, hate, sexual, violence). | keyword | +| azure.ai_foundry.properties.backend_response_body.content_filtered_categories.severity | The severity levels (safe, low, medium, and high). | keyword | +| azure.ai_foundry.properties.backend_response_body.created | The timestamp when the request was created. | long | +| azure.ai_foundry.properties.backend_response_body.error.code | The error code. | keyword | +| azure.ai_foundry.properties.backend_response_body.error.innererror.code | The error code. | keyword | +| azure.ai_foundry.properties.backend_response_body.error.innererror.content_filter_result.custom_blocklists.filtered | Request filtered by custom blocklist. | boolean | +| azure.ai_foundry.properties.backend_response_body.error.innererror.content_filter_result.custom_blocklists.id | The custom blocklist id. | keyword | +| azure.ai_foundry.properties.backend_response_body.error.innererror.content_filter_result.hate.filtered | True if the content filtered based on severity level. | boolean | +| azure.ai_foundry.properties.backend_response_body.error.innererror.content_filter_result.hate.severity | The severity levels (safe, low, medium, and high) for hate category. | keyword | +| azure.ai_foundry.properties.backend_response_body.error.innererror.content_filter_result.jailbreak.detected | True if jailbreak risk is detected. | boolean | +| azure.ai_foundry.properties.backend_response_body.error.innererror.content_filter_result.jailbreak.filtered | True if the content filtered for jailbreak category. | boolean | +| azure.ai_foundry.properties.backend_response_body.error.innererror.content_filter_result.profanity.detected | The profanity detected. | boolean | +| azure.ai_foundry.properties.backend_response_body.error.innererror.content_filter_result.profanity.filtered | Filtered by profanity. | boolean | +| azure.ai_foundry.properties.backend_response_body.error.innererror.content_filter_result.self_harm.filtered | True if the content filtered based on severity level. | boolean | +| azure.ai_foundry.properties.backend_response_body.error.innererror.content_filter_result.self_harm.severity | The severity levels (safe, low, medium, and high) for self-harm category. | keyword | +| azure.ai_foundry.properties.backend_response_body.error.innererror.content_filter_result.sexual.filtered | True if the content filtered based on severity level. | boolean | +| azure.ai_foundry.properties.backend_response_body.error.innererror.content_filter_result.sexual.severity | The severity levels (safe, low, medium, and high) for sexual category. | keyword | +| azure.ai_foundry.properties.backend_response_body.error.innererror.content_filter_result.violence.filtered | True if the content filtered based on severity level. | boolean | +| azure.ai_foundry.properties.backend_response_body.error.innererror.content_filter_result.violence.severity | The severity levels (safe, low, medium, and high) for violence category. | keyword | +| azure.ai_foundry.properties.backend_response_body.error.innererror.content_filtered_categories.category_name | The categories (self-harm, hate, sexual, violence). | keyword | +| azure.ai_foundry.properties.backend_response_body.error.innererror.content_filtered_categories.severity | The severity levels (safe, low, medium, and high). | keyword | +| azure.ai_foundry.properties.backend_response_body.error.message | The error message. | text | +| azure.ai_foundry.properties.backend_response_body.error.param | Parameter passed to the API. | keyword | +| azure.ai_foundry.properties.backend_response_body.error.status | The response status code. | long | +| azure.ai_foundry.properties.backend_response_body.id | A unique identifier for the request. | keyword | +| azure.ai_foundry.properties.backend_response_body.model | The ID of the Azure AI Foundry model used to generate the response. | keyword | +| azure.ai_foundry.properties.backend_response_body.object | The operation type. | keyword | +| azure.ai_foundry.properties.backend_response_body.prompt_filter_results.content_filter_results.hate.filtered | True if the content filtered based on severity level. | boolean | +| azure.ai_foundry.properties.backend_response_body.prompt_filter_results.content_filter_results.hate.severity | The severity levels (safe, low, medium, and high) for hate category. | keyword | +| azure.ai_foundry.properties.backend_response_body.prompt_filter_results.content_filter_results.jailbreak.detected | True if the jailbreak risk detected. | boolean | +| azure.ai_foundry.properties.backend_response_body.prompt_filter_results.content_filter_results.jailbreak.filtered | True if the content filtered for jailbreak category. | boolean | +| azure.ai_foundry.properties.backend_response_body.prompt_filter_results.content_filter_results.profanity.detected | The profanity detected. | boolean | +| azure.ai_foundry.properties.backend_response_body.prompt_filter_results.content_filter_results.profanity.filtered | Filtered by profanity. | boolean | +| azure.ai_foundry.properties.backend_response_body.prompt_filter_results.content_filter_results.self_harm.filtered | True if the content filtered based on severity level. | boolean | +| azure.ai_foundry.properties.backend_response_body.prompt_filter_results.content_filter_results.self_harm.severity | The severity levels (safe, low, medium, and high) for self-harm category. | keyword | +| azure.ai_foundry.properties.backend_response_body.prompt_filter_results.content_filter_results.sexual.filtered | True if the content filtered based on severity level. | boolean | +| azure.ai_foundry.properties.backend_response_body.prompt_filter_results.content_filter_results.sexual.severity | The severity levels (safe, low, medium, and high) for sexual category. | keyword | +| azure.ai_foundry.properties.backend_response_body.prompt_filter_results.content_filter_results.violence.filtered | True if the content filtered based on severity level. | boolean | +| azure.ai_foundry.properties.backend_response_body.prompt_filter_results.content_filter_results.violence.severity | The severity levels (safe, low, medium, and high) for violence category. | keyword | +| azure.ai_foundry.properties.backend_response_body.prompt_filter_results.prompt_index | Index of the prompt used to generate response. | long | +| azure.ai_foundry.properties.backend_response_body.system_fingerprint | The fingerprint is generated by Azure API Management and is used to track the performance and usage of the backend service. | keyword | +| azure.ai_foundry.properties.backend_response_body.usage.input_tokens | the total input tokens. | long | +| azure.ai_foundry.properties.backend_response_body.usage.output_tokens | The total output tokens. | long | +| azure.ai_foundry.properties.backend_response_body.usage.total_tokens | The sum of input and output tokens. | long | +| azure.ai_foundry.properties.backend_response_code | The backend HTTP response code. | long | +| azure.ai_foundry.properties.backend_time | The backend response time. | long | +| azure.ai_foundry.properties.backend_url | The backend URL connects to the Azure AI Foundry model. | keyword | +| azure.ai_foundry.properties.cache | The request cache. | keyword | +| azure.ai_foundry.properties.client_protocol | The client HTTP protocol. | keyword | +| azure.ai_foundry.properties.client_tls_cipher_suite | The client TLS Cipher Suite. | keyword | +| azure.ai_foundry.properties.client_tls_version | The client TLS version. | keyword | +| azure.ai_foundry.properties.model_deployment_name | The deployed model name. | keyword | +| azure.ai_foundry.properties.model_name | The Azure AI Foundry model. | keyword | +| azure.ai_foundry.properties.model_version | The Azure AI Foundry model version. | keyword | +| azure.ai_foundry.properties.object_id | The object id of the request. | keyword | +| azure.ai_foundry.properties.operation_id | The operation performed. | keyword | +| azure.ai_foundry.properties.request_length | Length of the request. | double | +| azure.ai_foundry.properties.request_time | Request time taken. | long | +| azure.ai_foundry.properties.response_length | Length of the response. | double | +| azure.ai_foundry.properties.response_time | Response time taken. | long | +| azure.ai_foundry.properties.stream_type | The stream type of the request. | keyword | +| azure.ai_foundry.result_signature | The response status. | keyword | +| azure.ai_foundry.service_name | The service name. | keyword | +| azure.ai_foundry.sku | Stock Keeping Unit that is associated with a particular API Management instance. | keyword | +| azure.ai_foundry.tenant | The tenant location. | keyword | +| azure.ai_foundry.truncated | Condition where the response message is too large to fit in a single packet, so it is truncated or cut off. | long | +| azure.resource.authorization_rule | Authorization rule | keyword | +| azure.resource.group | The resource group | keyword | +| azure.resource.id | Resource ID | keyword | +| azure.resource.name | The name of the resource | keyword | +| azure.resource.namespace | Resource type/namespace | keyword | +| azure.resource.provider | The resource group | keyword | +| azure.resource.type | The type of the resource | keyword | +| azure.subscription_id | The subscription ID | keyword | +| data_stream.dataset | Data stream dataset. | constant_keyword | +| data_stream.namespace | Data stream namespace. | constant_keyword | +| data_stream.type | Data stream type. | constant_keyword | + + #### Metrics Reference The Azure AI Foundry metrics provide insights into the performance and usage of your AI resources. These metrics help in monitoring and optimizing your deployments. diff --git a/packages/azure_ai_foundry/img/azure_ai_foundry_apim_overview.png b/packages/azure_ai_foundry/img/azure_ai_foundry_apim_overview.png new file mode 100644 index 00000000000..2de650bee2f Binary files /dev/null and b/packages/azure_ai_foundry/img/azure_ai_foundry_apim_overview.png differ diff --git a/packages/azure_ai_foundry/kibana/dashboard/azure_ai_foundry-2b21bfb1-6fc2-45c5-9f0f-1e15aaab5245.json b/packages/azure_ai_foundry/kibana/dashboard/azure_ai_foundry-2b21bfb1-6fc2-45c5-9f0f-1e15aaab5245.json new file mode 100644 index 00000000000..57d00fbc738 --- /dev/null +++ b/packages/azure_ai_foundry/kibana/dashboard/azure_ai_foundry-2b21bfb1-6fc2-45c5-9f0f-1e15aaab5245.json @@ -0,0 +1,2122 @@ +{ + "attributes": { + "controlGroupInput": { + "chainingSystem": "HIERARCHICAL", + "controlStyle": "oneLine", + "ignoreParentSettingsJSON": { + "ignoreFilters": false, + "ignoreQuery": false, + "ignoreTimerange": false, + "ignoreValidations": false + }, + "panelsJSON": { + "d88777b3-994b-458d-b663-434266709856": { + "explicitInput": { + "dataViewId": "logs-*", + "fieldName": "azure.resource.group", + "id": "d88777b3-994b-458d-b663-434266709856", + "searchTechnique": "prefix", + "selectedOptions": [], + "sort": { + "by": "_count", + "direction": "desc" + }, + "title": "Resource Group" + }, + "grow": true, + "order": 1, + "type": "optionsListControl", + "width": "medium" + }, + "ddfaa3fd-acee-45f8-b315-848e59e73bf7": { + "explicitInput": { + "dataViewId": "logs-*", + "fieldName": "azure.resource.name", + "id": "ddfaa3fd-acee-45f8-b315-848e59e73bf7", + "searchTechnique": "prefix", + "selectedOptions": [], + "sort": { + "by": "_count", + "direction": "desc" + }, + "title": "Resources" + }, + "grow": true, + "order": 2, + "type": "optionsListControl", + "width": "medium" + }, + "ece38ab0-4060-445d-88d6-06b669d2115c": { + "explicitInput": { + "dataViewId": "logs-*", + "fieldName": "azure.subscription_id", + "id": "ece38ab0-4060-445d-88d6-06b669d2115c", + "searchTechnique": "prefix", + "selectedOptions": [], + "sort": { + "by": "_count", + "direction": "desc" + }, + "title": "Subscriptions" + }, + "grow": true, + "order": 0, + "type": "optionsListControl", + "width": "medium" + } + }, + "showApplySelections": false + }, + "description": "", + "kibanaSavedObjectMeta": { + "searchSourceJSON": { + "filter": [], + "query": { + "language": "kuery", + "query": "" + } + } + }, + "optionsJSON": { + "hidePanelTitles": false, + "syncColors": false, + "syncCursor": true, + "syncTooltips": false, + "useMargins": true + }, + "panelsJSON": [ + { + "embeddableConfig": { + "density": "compact", + "description": "", + "enhancements": { + "dynamicActions": { + "events": [] + } + }, + "grid": { + "columns": { + "azure.ai_foundry.properties.backend_request_body.messages.content": { + "width": 252 + }, + "azure.ai_foundry.properties.backend_response_body.choices.message.content": { + "width": 461 + } + } + }, + "headerRowHeight": 3, + "rowHeight": -1, + "sampleSize": 500 + }, + "gridData": { + "h": 16, + "i": "1777b180-02e0-4ad6-904e-137bf6a59c7c", + "w": 48, + "x": 0, + "y": 39 + }, + "panelIndex": "1777b180-02e0-4ad6-904e-137bf6a59c7c", + "panelRefName": "panel_1777b180-02e0-4ad6-904e-137bf6a59c7c", + "title": "Prompt, response, token usage", + "type": "search" + }, + { + "embeddableConfig": { + "enhancements": { + "dynamicActions": { + "events": [] + } + }, + "savedVis": { + "data": { + "aggs": [], + "searchSource": { + "filter": [], + "query": { + "language": "kuery", + "query": "" + } + } + }, + "description": "", + "id": "", + "params": { + "fontSize": 12, + "markdown": "Azure AI Foundry(API Management Service)\n\nThis dashboard primarily focus on logs for Azure AI Foundry service connects via API Management Service. This dashboard contains:\n\n- Request rate\n- Error rate\n- Model usage\n- Latency\n- LLM prompt input, Response completion", + "openLinksInNewTab": false + }, + "title": "", + "type": "markdown", + "uiState": {} + } + }, + "gridData": { + "h": 12, + "i": "1c0964c2-0a80-470a-9a34-9d1456d78818", + "w": 11, + "x": 0, + "y": 0 + }, + "panelIndex": "1c0964c2-0a80-470a-9a34-9d1456d78818", + "type": "visualization" + }, + { + "embeddableConfig": { + "attributes": { + "references": [ + { + "id": "logs-*", + "name": "indexpattern-datasource-layer-b755cd44-08f2-4880-919d-864797dd4183", + "type": "index-pattern" + }, + { + "id": "logs-*", + "name": "indexpattern-datasource-layer-fae1c18e-dcef-40ee-95ed-dd853e3b167a", + "type": "index-pattern" + } + ], + "state": { + "adHocDataViews": {}, + "datasourceStates": { + "formBased": { + "currentIndexPatternId": "logs-*", + "layers": { + "b755cd44-08f2-4880-919d-864797dd4183": { + "columnOrder": [ + "68f4dfa1-7279-4644-a9c7-7b7be8bca040", + "0821c997-f02d-4f91-9216-ab0eae677141" + ], + "columns": { + "0821c997-f02d-4f91-9216-ab0eae677141": { + "customLabel": true, + "dataType": "number", + "isBucketed": false, + "label": "Total tokens", + "operationType": "sum", + "params": { + "emptyAsNull": true + }, + "scale": "ratio", + "sourceField": "azure.ai_foundry.properties.backend_response_body.usage.total_tokens" + }, + "68f4dfa1-7279-4644-a9c7-7b7be8bca040": { + "dataType": "date", + "isBucketed": true, + "label": "@timestamp", + "operationType": "date_histogram", + "params": { + "dropPartials": false, + "includeEmptyRows": true, + "interval": "auto" + }, + "scale": "interval", + "sourceField": "@timestamp" + } + }, + "ignoreGlobalFilters": false, + "incompleteColumns": {}, + "indexPatternId": "logs-*", + "linkToLayers": [ + "fae1c18e-dcef-40ee-95ed-dd853e3b167a" + ], + "sampling": 1 + }, + "fae1c18e-dcef-40ee-95ed-dd853e3b167a": { + "columnOrder": [ + "e0a2a653-bf95-4fc5-a3fb-0743cdd4e2fa" + ], + "columns": { + "e0a2a653-bf95-4fc5-a3fb-0743cdd4e2fa": { + "customLabel": true, + "dataType": "number", + "filter": { + "language": "kuery", + "query": "azure.ai_foundry.is_request_success : true " + }, + "isBucketed": false, + "label": "Total requests", + "operationType": "count", + "params": { + "emptyAsNull": true, + "format": { + "id": "number", + "params": { + "compact": true, + "decimals": 0 + } + } + }, + "scale": "ratio", + "sourceField": "azure.ai_foundry.is_request_success" + } + }, + "incompleteColumns": {}, + "indexPatternId": "logs-*" + } + } + }, + "indexpattern": { + "currentIndexPatternId": "logs-*", + "layers": {} + }, + "textBased": { + "indexPatternRefs": [ + { + "id": "logs-*", + "timeField": "@timestamp", + "title": "logs-*" + } + ], + "layers": {} + } + }, + "filters": [], + "internalReferences": [], + "query": { + "language": "kuery", + "query": "" + }, + "visualization": { + "color": "#BFDBFF", + "layerId": "fae1c18e-dcef-40ee-95ed-dd853e3b167a", + "layerType": "data", + "metricAccessor": "e0a2a653-bf95-4fc5-a3fb-0743cdd4e2fa", + "showBar": false + } + }, + "title": "", + "type": "lens", + "visualizationType": "lnsMetric" + }, + "description": "Overall successful requests.", + "enhancements": { + "dynamicActions": { + "events": [] + } + }, + "filters": [], + "query": { + "language": "kuery", + "query": "" + }, + "searchSessionId": "bf00eebd-c4ac-4941-9fea-fc45d194bf8c", + "syncColors": false, + "syncCursor": true, + "syncTooltips": false + }, + "gridData": { + "h": 6, + "i": "a1a2f0c4-40aa-4686-b066-265c64999c60", + "w": 6, + "x": 11, + "y": 0 + }, + "panelIndex": "a1a2f0c4-40aa-4686-b066-265c64999c60", + "title": "", + "type": "lens" + }, + { + "embeddableConfig": { + "attributes": { + "description": "", + "layerListJSON": [ + { + "alpha": 1, + "areLabelsOnTop": true, + "id": "2db8edad-69f6-4db7-a63e-4f578d2e343e", + "includeInFitToBounds": true, + "label": null, + "locale": "autoselect", + "maxZoom": 15, + "minZoom": 0, + "sourceDescriptor": { + "isAutoSelect": true, + "lightModeDefault": "road_map_desaturated_v9", + "type": "EMS_TMS" + }, + "style": { + "color": "#61A2FF", + "type": "EMS_VECTOR_TILE" + }, + "type": "EMS_VECTOR_TILE", + "visible": true + }, + { + "alpha": 0.75, + "disableTooltips": false, + "id": "5883e407-1e3a-420e-b497-abb2a21c9dc6", + "includeInFitToBounds": true, + "joins": [], + "label": null, + "maxZoom": 24, + "minZoom": 0, + "sourceDescriptor": { + "applyForceRefresh": true, + "applyGlobalQuery": true, + "applyGlobalTime": true, + "filterByMapBounds": true, + "geoField": "source.geo.location", + "id": "39ff34a8-136d-4c3a-9ea6-677d8713f933", + "indexPatternRefName": "layer_1_source_index_pattern", + "scalingType": "MVT", + "sortField": "", + "sortOrder": "desc", + "tooltipProperties": [], + "topHitsGroupByTimeseries": false, + "topHitsSize": 1, + "topHitsSplitField": "", + "type": "ES_SEARCH" + }, + "style": { + "isTimeAware": true, + "properties": { + "fillColor": { + "options": { + "color": "#16C5C0" + }, + "type": "STATIC" + }, + "icon": { + "options": { + "value": "marker" + }, + "type": "STATIC" + }, + "iconOrientation": { + "options": { + "orientation": 0 + }, + "type": "STATIC" + }, + "iconSize": { + "options": { + "size": 6 + }, + "type": "STATIC" + }, + "labelBorderColor": { + "options": { + "color": "#FFFFFF" + }, + "type": "STATIC" + }, + "labelBorderSize": { + "options": { + "size": "SMALL" + } + }, + "labelColor": { + "options": { + "color": "#000000" + }, + "type": "STATIC" + }, + "labelPosition": { + "options": { + "position": "CENTER" + } + }, + "labelSize": { + "options": { + "size": 14 + }, + "type": "STATIC" + }, + "labelText": { + "options": { + "value": "" + }, + "type": "STATIC" + }, + "labelZoomRange": { + "options": { + "maxZoom": 24, + "minZoom": 0, + "useLayerZoomRange": true + } + }, + "lineColor": { + "options": { + "color": "#119793" + }, + "type": "STATIC" + }, + "lineWidth": { + "options": { + "size": 0 + }, + "type": "STATIC" + }, + "symbolizeAs": { + "options": { + "value": "circle" + } + } + }, + "type": "VECTOR" + }, + "type": "MVT_VECTOR", + "visible": true + } + ], + "mapStateJSON": { + "adHocDataViews": [], + "center": { + "lat": 0, + "lon": -42.18518 + }, + "filters": [], + "query": { + "language": "kuery", + "query": "" + }, + "refreshConfig": { + "interval": 60000, + "isPaused": true + }, + "settings": { + "autoFitToDataBounds": false, + "backgroundColor": "transparent", + "browserLocation": { + "zoom": 2 + }, + "customIcons": [], + "disableInteractive": false, + "disableTooltipControl": false, + "fixedLocation": { + "lat": 0, + "lon": 0, + "zoom": 2 + }, + "hideLayerControl": false, + "hideToolbarOverlay": false, + "hideViewControl": false, + "initialLocation": "LAST_SAVED_LOCATION", + "keydownScrollZoom": false, + "maxZoom": 24, + "minZoom": 0, + "showScaleControl": false, + "showSpatialFilters": true, + "showTimesliderToggleButton": true, + "spatialFiltersAlpa": 0.3, + "spatialFiltersFillColor": "#DA8B45", + "spatialFiltersLineColor": "#DA8B45" + }, + "timeFilters": { + "from": "now-7d/d", + "to": "now" + }, + "zoom": 0.61 + }, + "title": "", + "uiStateJSON": { + "isLayerTOCOpen": true, + "openTOCDetails": [] + } + }, + "description": "Plot the requests by the caller IP address.", + "enhancements": { + "dynamicActions": { + "events": [] + } + }, + "filterByMapExtent": false, + "hiddenLayers": [], + "isLayerTOCOpen": false, + "mapBuffer": { + "maxLat": 66.51326, + "maxLon": 90, + "minLat": 40.9799, + "minLon": -67.5 + }, + "mapCenter": { + "lat": 55.17998, + "lon": 7.7618, + "zoom": 3.2 + }, + "openTOCDetails": [] + }, + "gridData": { + "h": 12, + "i": "3638b4c5-7ab9-494f-a796-40d854f3988c", + "w": 25, + "x": 23, + "y": 0 + }, + "panelIndex": "3638b4c5-7ab9-494f-a796-40d854f3988c", + "title": "Request location", + "type": "map" + }, + { + "embeddableConfig": { + "attributes": { + "references": [ + { + "id": "logs-*", + "name": "indexpattern-datasource-layer-473e6010-87d8-4cf3-80ad-f8a900324b91", + "type": "index-pattern" + } + ], + "state": { + "adHocDataViews": {}, + "datasourceStates": { + "formBased": { + "currentIndexPatternId": "logs-*", + "layers": { + "473e6010-87d8-4cf3-80ad-f8a900324b91": { + "columnOrder": [ + "8ea8e229-b8d3-454d-9c8d-f9eab21b4a12", + "8544635c-fd87-40d7-83cf-27f6f8df0be1" + ], + "columns": { + "8544635c-fd87-40d7-83cf-27f6f8df0be1": { + "dataType": "number", + "isBucketed": false, + "label": "Count of records", + "operationType": "count", + "params": { + "emptyAsNull": true + }, + "scale": "ratio", + "sourceField": "___records___" + }, + "8ea8e229-b8d3-454d-9c8d-f9eab21b4a12": { + "dataType": "string", + "isBucketed": true, + "label": "Top 5 values of Model", + "operationType": "terms", + "params": { + "exclude": [], + "excludeIsRegex": false, + "include": [], + "includeIsRegex": false, + "missingBucket": false, + "orderBy": { + "columnId": "8544635c-fd87-40d7-83cf-27f6f8df0be1", + "type": "column" + }, + "orderDirection": "desc", + "otherBucket": true, + "parentFormat": { + "id": "terms" + }, + "secondaryFields": [], + "size": 5 + }, + "scale": "ordinal", + "sourceField": "azure.ai_foundry.properties.backend_request_body.model" + } + }, + "incompleteColumns": {}, + "indexPatternId": "logs-*", + "sampling": 1 + } + } + }, + "indexpattern": { + "currentIndexPatternId": "logs-*", + "layers": {} + }, + "textBased": { + "indexPatternRefs": [ + { + "id": "logs-*", + "timeField": "@timestamp", + "title": "logs-*" + } + ], + "layers": {} + } + }, + "filters": [], + "internalReferences": [], + "query": { + "language": "kuery", + "query": "" + }, + "visualization": { + "layers": [ + { + "categoryDisplay": "hide", + "colorMapping": { + "assignments": [], + "colorMode": { + "type": "categorical" + }, + "paletteId": "default", + "specialAssignments": [ + { + "color": { + "type": "loop" + }, + "rule": { + "type": "other" + }, + "touched": false + } + ] + }, + "emptySizeRatio": 0.54, + "layerId": "473e6010-87d8-4cf3-80ad-f8a900324b91", + "layerType": "data", + "legendDisplay": "show", + "metrics": [ + "8544635c-fd87-40d7-83cf-27f6f8df0be1" + ], + "nestedLegend": false, + "numberDisplay": "percent", + "primaryGroups": [ + "8ea8e229-b8d3-454d-9c8d-f9eab21b4a12" + ], + "truncateLegend": true + } + ], + "shape": "donut" + } + }, + "title": "", + "type": "lens", + "visualizationType": "lnsPie" + }, + "description": "Overall model usage by LLM models", + "enhancements": { + "dynamicActions": { + "events": [] + } + }, + "filters": [], + "query": { + "language": "kuery", + "query": "" + }, + "searchSessionId": "bf00eebd-c4ac-4941-9fea-fc45d194bf8c", + "syncColors": false, + "syncCursor": true, + "syncTooltips": false + }, + "gridData": { + "h": 9, + "i": "1d795f37-34cc-4ff2-8dce-6feb3f77dd85", + "w": 11, + "x": 0, + "y": 30 + }, + "panelIndex": "1d795f37-34cc-4ff2-8dce-6feb3f77dd85", + "title": "Model usage", + "type": "lens" + }, + { + "embeddableConfig": { + "attributes": { + "references": [ + { + "id": "logs-*", + "name": "indexpattern-datasource-layer-473e6010-87d8-4cf3-80ad-f8a900324b91", + "type": "index-pattern" + } + ], + "state": { + "adHocDataViews": {}, + "datasourceStates": { + "formBased": { + "currentIndexPatternId": "logs-*", + "layers": { + "473e6010-87d8-4cf3-80ad-f8a900324b91": { + "columnOrder": [ + "8ea8e229-b8d3-454d-9c8d-f9eab21b4a12", + "c1a321c2-2312-4304-a0c9-6021fde84c7b", + "8544635c-fd87-40d7-83cf-27f6f8df0be1" + ], + "columns": { + "8544635c-fd87-40d7-83cf-27f6f8df0be1": { + "dataType": "number", + "isBucketed": false, + "label": "Sum of Total token", + "operationType": "sum", + "params": { + "emptyAsNull": true + }, + "scale": "ratio", + "sourceField": "azure.ai_foundry.properties.backend_response_body.usage.total_tokens" + }, + "8ea8e229-b8d3-454d-9c8d-f9eab21b4a12": { + "dataType": "string", + "isBucketed": true, + "label": "Top 10 values of Model", + "operationType": "terms", + "params": { + "exclude": [], + "excludeIsRegex": false, + "include": [], + "includeIsRegex": false, + "missingBucket": false, + "orderBy": { + "columnId": "8544635c-fd87-40d7-83cf-27f6f8df0be1", + "type": "column" + }, + "orderDirection": "desc", + "otherBucket": true, + "parentFormat": { + "id": "terms" + }, + "secondaryFields": [], + "size": 10 + }, + "scale": "ordinal", + "sourceField": "azure.ai_foundry.properties.backend_request_body.model" + }, + "c1a321c2-2312-4304-a0c9-6021fde84c7b": { + "dataType": "date", + "isBucketed": true, + "label": "@timestamp", + "operationType": "date_histogram", + "params": { + "dropPartials": false, + "includeEmptyRows": true, + "interval": "auto" + }, + "scale": "interval", + "sourceField": "@timestamp" + } + }, + "incompleteColumns": {}, + "indexPatternId": "logs-*", + "sampling": 1 + } + } + } + }, + "filters": [], + "internalReferences": [], + "query": { + "language": "kuery", + "query": "" + }, + "visualization": { + "axisTitlesVisibilitySettings": { + "x": false, + "yLeft": false, + "yRight": false + }, + "fittingFunction": "Linear", + "gridlinesVisibilitySettings": { + "x": true, + "yLeft": true, + "yRight": true + }, + "labelsOrientation": { + "x": 0, + "yLeft": 0, + "yRight": 0 + }, + "layers": [ + { + "accessors": [ + "8544635c-fd87-40d7-83cf-27f6f8df0be1" + ], + "colorMapping": { + "assignments": [], + "colorMode": { + "type": "categorical" + }, + "paletteId": "default", + "specialAssignments": [ + { + "color": { + "type": "loop" + }, + "rule": { + "type": "other" + }, + "touched": false + } + ] + }, + "layerId": "473e6010-87d8-4cf3-80ad-f8a900324b91", + "layerType": "data", + "seriesType": "bar_stacked", + "splitAccessor": "8ea8e229-b8d3-454d-9c8d-f9eab21b4a12", + "xAccessor": "c1a321c2-2312-4304-a0c9-6021fde84c7b" + } + ], + "legend": { + "isInside": false, + "isVisible": true, + "position": "bottom", + "showSingleSeries": false + }, + "preferredSeriesType": "bar", + "tickLabelsVisibilitySettings": { + "x": true, + "yLeft": true, + "yRight": true + }, + "valueLabels": "hide" + } + }, + "title": "", + "type": "lens", + "visualizationType": "lnsXY" + }, + "description": "Total tokens utilized by LLM model", + "enhancements": { + "dynamicActions": { + "events": [] + } + }, + "filters": [], + "query": { + "language": "kuery", + "query": "" + }, + "searchSessionId": "bf00eebd-c4ac-4941-9fea-fc45d194bf8c", + "syncColors": false, + "syncCursor": true, + "syncTooltips": false + }, + "gridData": { + "h": 9, + "i": "b368e5e4-a08e-4d85-904c-aabbd9cffc69", + "w": 37, + "x": 11, + "y": 30 + }, + "panelIndex": "b368e5e4-a08e-4d85-904c-aabbd9cffc69", + "title": "Total tokens - by model", + "type": "lens" + }, + { + "embeddableConfig": { + "attributes": { + "references": [ + { + "id": "logs-*", + "name": "indexpattern-datasource-layer-b755cd44-08f2-4880-919d-864797dd4183", + "type": "index-pattern" + }, + { + "id": "logs-*", + "name": "indexpattern-datasource-layer-fae1c18e-dcef-40ee-95ed-dd853e3b167a", + "type": "index-pattern" + } + ], + "state": { + "adHocDataViews": {}, + "datasourceStates": { + "formBased": { + "currentIndexPatternId": "logs-*", + "layers": { + "b755cd44-08f2-4880-919d-864797dd4183": { + "columnOrder": [ + "68f4dfa1-7279-4644-a9c7-7b7be8bca040", + "0821c997-f02d-4f91-9216-ab0eae677141" + ], + "columns": { + "0821c997-f02d-4f91-9216-ab0eae677141": { + "customLabel": true, + "dataType": "number", + "isBucketed": false, + "label": "Total tokens", + "operationType": "sum", + "params": { + "emptyAsNull": true + }, + "scale": "ratio", + "sourceField": "azure.ai_foundry.properties.backend_response_body.usage.total_tokens" + }, + "68f4dfa1-7279-4644-a9c7-7b7be8bca040": { + "dataType": "date", + "isBucketed": true, + "label": "@timestamp", + "operationType": "date_histogram", + "params": { + "dropPartials": false, + "includeEmptyRows": true, + "interval": "auto" + }, + "scale": "interval", + "sourceField": "@timestamp" + } + }, + "ignoreGlobalFilters": false, + "incompleteColumns": {}, + "indexPatternId": "logs-*", + "linkToLayers": [ + "fae1c18e-dcef-40ee-95ed-dd853e3b167a" + ], + "sampling": 1 + }, + "fae1c18e-dcef-40ee-95ed-dd853e3b167a": { + "columnOrder": [ + "e0a2a653-bf95-4fc5-a3fb-0743cdd4e2fa" + ], + "columns": { + "e0a2a653-bf95-4fc5-a3fb-0743cdd4e2fa": { + "customLabel": true, + "dataType": "number", + "isBucketed": false, + "label": "Total tokens", + "operationType": "sum", + "params": { + "emptyAsNull": true, + "format": { + "id": "number", + "params": { + "compact": true, + "decimals": 2 + } + } + }, + "scale": "ratio", + "sourceField": "azure.ai_foundry.properties.backend_response_body.usage.total_tokens" + } + }, + "incompleteColumns": {}, + "indexPatternId": "logs-*" + } + } + }, + "indexpattern": { + "currentIndexPatternId": "logs-*", + "layers": {} + }, + "textBased": { + "indexPatternRefs": [ + { + "id": "logs-*", + "timeField": "@timestamp", + "title": "logs-*" + } + ], + "layers": {} + } + }, + "filters": [], + "internalReferences": [], + "query": { + "language": "kuery", + "query": "" + }, + "visualization": { + "color": "#61A2FF", + "layerId": "fae1c18e-dcef-40ee-95ed-dd853e3b167a", + "layerType": "data", + "metricAccessor": "e0a2a653-bf95-4fc5-a3fb-0743cdd4e2fa", + "showBar": false + } + }, + "title": "", + "type": "lens", + "visualizationType": "lnsMetric" + }, + "description": "Overall tokens utilized", + "enhancements": { + "dynamicActions": { + "events": [] + } + }, + "filters": [], + "query": { + "language": "kuery", + "query": "" + }, + "searchSessionId": "bf00eebd-c4ac-4941-9fea-fc45d194bf8c", + "syncColors": false, + "syncCursor": true, + "syncTooltips": false + }, + "gridData": { + "h": 6, + "i": "85057d86-e483-40af-9b6a-56d1f66e75fd", + "w": 6, + "x": 17, + "y": 0 + }, + "panelIndex": "85057d86-e483-40af-9b6a-56d1f66e75fd", + "title": "", + "type": "lens" + }, + { + "embeddableConfig": { + "attributes": { + "references": [ + { + "id": "logs-*", + "name": "indexpattern-datasource-layer-fae1c18e-dcef-40ee-95ed-dd853e3b167a", + "type": "index-pattern" + }, + { + "id": "logs-*", + "name": "indexpattern-datasource-layer-b755cd44-08f2-4880-919d-864797dd4183", + "type": "index-pattern" + } + ], + "state": { + "adHocDataViews": {}, + "datasourceStates": { + "formBased": { + "currentIndexPatternId": "logs-*", + "layers": { + "b755cd44-08f2-4880-919d-864797dd4183": { + "columnOrder": [ + "68f4dfa1-7279-4644-a9c7-7b7be8bca040", + "0821c997-f02d-4f91-9216-ab0eae677141" + ], + "columns": { + "0821c997-f02d-4f91-9216-ab0eae677141": { + "customLabel": true, + "dataType": "number", + "isBucketed": false, + "label": "Total tokens", + "operationType": "sum", + "params": { + "emptyAsNull": true + }, + "scale": "ratio", + "sourceField": "azure.ai_foundry.properties.backend_response_body.usage.total_tokens" + }, + "68f4dfa1-7279-4644-a9c7-7b7be8bca040": { + "dataType": "date", + "isBucketed": true, + "label": "@timestamp", + "operationType": "date_histogram", + "params": { + "dropPartials": false, + "includeEmptyRows": true, + "interval": "auto" + }, + "scale": "interval", + "sourceField": "@timestamp" + } + }, + "ignoreGlobalFilters": false, + "incompleteColumns": {}, + "indexPatternId": "logs-*", + "linkToLayers": [ + "fae1c18e-dcef-40ee-95ed-dd853e3b167a" + ], + "sampling": 1 + }, + "fae1c18e-dcef-40ee-95ed-dd853e3b167a": { + "columnOrder": [ + "e0a2a653-bf95-4fc5-a3fb-0743cdd4e2fa" + ], + "columns": { + "e0a2a653-bf95-4fc5-a3fb-0743cdd4e2fa": { + "customLabel": true, + "dataType": "number", + "filter": { + "language": "kuery", + "query": "azure.ai_foundry.is_request_success : false " + }, + "isBucketed": false, + "label": "Errors", + "operationType": "count", + "params": { + "emptyAsNull": true + }, + "scale": "ratio", + "sourceField": "azure.ai_foundry.is_request_success" + } + }, + "incompleteColumns": {}, + "indexPatternId": "logs-*" + } + } + }, + "indexpattern": { + "currentIndexPatternId": "logs-*", + "layers": {} + }, + "textBased": { + "indexPatternRefs": [ + { + "id": "logs-*", + "timeField": "@timestamp", + "title": "logs-*" + } + ], + "layers": {} + } + }, + "filters": [], + "internalReferences": [], + "query": { + "language": "kuery", + "query": "" + }, + "visualization": { + "color": "#ea3c3cba", + "layerId": "fae1c18e-dcef-40ee-95ed-dd853e3b167a", + "layerType": "data", + "metricAccessor": "e0a2a653-bf95-4fc5-a3fb-0743cdd4e2fa", + "showBar": false + } + }, + "title": "", + "type": "lens", + "visualizationType": "lnsMetric" + }, + "description": "Total errors for the selected time range.", + "enhancements": { + "dynamicActions": { + "events": [] + } + }, + "filters": [], + "query": { + "language": "kuery", + "query": "" + }, + "searchSessionId": "bf00eebd-c4ac-4941-9fea-fc45d194bf8c", + "syncColors": false, + "syncCursor": true, + "syncTooltips": false + }, + "gridData": { + "h": 6, + "i": "573035b9-1c27-4fe3-9f23-7575d13146a1", + "w": 6, + "x": 11, + "y": 6 + }, + "panelIndex": "573035b9-1c27-4fe3-9f23-7575d13146a1", + "title": "", + "type": "lens" + }, + { + "embeddableConfig": { + "attributes": { + "references": [ + { + "id": "logs-*", + "name": "indexpattern-datasource-layer-b755cd44-08f2-4880-919d-864797dd4183", + "type": "index-pattern" + }, + { + "id": "logs-*", + "name": "indexpattern-datasource-layer-fae1c18e-dcef-40ee-95ed-dd853e3b167a", + "type": "index-pattern" + } + ], + "state": { + "adHocDataViews": {}, + "datasourceStates": { + "formBased": { + "currentIndexPatternId": "logs-*", + "layers": { + "b755cd44-08f2-4880-919d-864797dd4183": { + "columnOrder": [ + "68f4dfa1-7279-4644-a9c7-7b7be8bca040", + "0821c997-f02d-4f91-9216-ab0eae677141" + ], + "columns": { + "0821c997-f02d-4f91-9216-ab0eae677141": { + "customLabel": true, + "dataType": "number", + "isBucketed": false, + "label": "Total tokens", + "operationType": "sum", + "params": { + "emptyAsNull": true + }, + "scale": "ratio", + "sourceField": "azure.ai_foundry.properties.backend_response_body.usage.total_tokens" + }, + "68f4dfa1-7279-4644-a9c7-7b7be8bca040": { + "dataType": "date", + "isBucketed": true, + "label": "@timestamp", + "operationType": "date_histogram", + "params": { + "dropPartials": false, + "includeEmptyRows": true, + "interval": "auto" + }, + "scale": "interval", + "sourceField": "@timestamp" + } + }, + "ignoreGlobalFilters": false, + "incompleteColumns": {}, + "indexPatternId": "logs-*", + "linkToLayers": [ + "fae1c18e-dcef-40ee-95ed-dd853e3b167a" + ], + "sampling": 1 + }, + "fae1c18e-dcef-40ee-95ed-dd853e3b167a": { + "columnOrder": [ + "e0a2a653-bf95-4fc5-a3fb-0743cdd4e2fa" + ], + "columns": { + "e0a2a653-bf95-4fc5-a3fb-0743cdd4e2fa": { + "customLabel": true, + "dataType": "number", + "isBucketed": false, + "label": "Average latency", + "operationType": "average", + "params": { + "emptyAsNull": true, + "format": { + "id": "duration", + "params": { + "compact": true, + "decimals": 2, + "fromUnit": "milliseconds", + "toUnit": "humanizePrecise" + } + } + }, + "scale": "ratio", + "sourceField": "azure.ai_foundry.duration_ms" + } + }, + "incompleteColumns": {}, + "indexPatternId": "logs-*" + } + } + }, + "indexpattern": { + "currentIndexPatternId": "logs-*", + "layers": {} + }, + "textBased": { + "indexPatternRefs": [ + { + "id": "logs-*", + "timeField": "@timestamp", + "title": "logs-*" + } + ], + "layers": {} + } + }, + "filters": [], + "internalReferences": [], + "query": { + "language": "kuery", + "query": "" + }, + "visualization": { + "color": "#a6b3ed", + "layerId": "fae1c18e-dcef-40ee-95ed-dd853e3b167a", + "layerType": "data", + "metricAccessor": "e0a2a653-bf95-4fc5-a3fb-0743cdd4e2fa", + "showBar": false + } + }, + "title": "", + "type": "lens", + "visualizationType": "lnsMetric" + }, + "description": "Average latency for the selected time range.", + "enhancements": { + "dynamicActions": { + "events": [] + } + }, + "filters": [], + "query": { + "language": "kuery", + "query": "" + }, + "searchSessionId": "bf00eebd-c4ac-4941-9fea-fc45d194bf8c", + "syncColors": false, + "syncCursor": true, + "syncTooltips": false + }, + "gridData": { + "h": 6, + "i": "385d0db0-1e2b-42dc-b0b0-10c7a6c4c9d0", + "w": 6, + "x": 17, + "y": 6 + }, + "panelIndex": "385d0db0-1e2b-42dc-b0b0-10c7a6c4c9d0", + "title": "", + "type": "lens" + }, + { + "embeddableConfig": { + "attributes": { + "references": [ + { + "id": "logs-*", + "name": "indexpattern-datasource-layer-473e6010-87d8-4cf3-80ad-f8a900324b91", + "type": "index-pattern" + } + ], + "state": { + "adHocDataViews": {}, + "datasourceStates": { + "formBased": { + "currentIndexPatternId": "logs-*", + "layers": { + "473e6010-87d8-4cf3-80ad-f8a900324b91": { + "columnOrder": [ + "8ea8e229-b8d3-454d-9c8d-f9eab21b4a12", + "8544635c-fd87-40d7-83cf-27f6f8df0be1" + ], + "columns": { + "8544635c-fd87-40d7-83cf-27f6f8df0be1": { + "dataType": "number", + "isBucketed": false, + "label": "Count of records", + "operationType": "count", + "params": { + "emptyAsNull": true + }, + "scale": "ratio", + "sourceField": "___records___" + }, + "8ea8e229-b8d3-454d-9c8d-f9eab21b4a12": { + "dataType": "string", + "isBucketed": true, + "label": "Top 5 values of azure.ai_foundry.sku", + "operationType": "terms", + "params": { + "exclude": [], + "excludeIsRegex": false, + "include": [], + "includeIsRegex": false, + "missingBucket": false, + "orderBy": { + "columnId": "8544635c-fd87-40d7-83cf-27f6f8df0be1", + "type": "column" + }, + "orderDirection": "desc", + "otherBucket": true, + "parentFormat": { + "id": "terms" + }, + "size": 5 + }, + "scale": "ordinal", + "sourceField": "azure.ai_foundry.sku" + } + }, + "incompleteColumns": {}, + "indexPatternId": "logs-*", + "sampling": 1 + } + } + }, + "indexpattern": { + "currentIndexPatternId": "logs-*", + "layers": {} + }, + "textBased": { + "indexPatternRefs": [ + { + "id": "logs-*", + "timeField": "@timestamp", + "title": "logs-*" + } + ], + "layers": {} + } + }, + "filters": [], + "internalReferences": [], + "query": { + "language": "kuery", + "query": "" + }, + "visualization": { + "layers": [ + { + "categoryDisplay": "hide", + "colorMapping": { + "assignments": [], + "colorMode": { + "type": "categorical" + }, + "paletteId": "default", + "specialAssignments": [ + { + "color": { + "type": "loop" + }, + "rule": { + "type": "other" + }, + "touched": false + } + ] + }, + "emptySizeRatio": 0.54, + "layerId": "473e6010-87d8-4cf3-80ad-f8a900324b91", + "layerType": "data", + "legendDisplay": "show", + "metrics": [ + "8544635c-fd87-40d7-83cf-27f6f8df0be1" + ], + "nestedLegend": false, + "numberDisplay": "percent", + "primaryGroups": [ + "8ea8e229-b8d3-454d-9c8d-f9eab21b4a12" + ], + "truncateLegend": true + } + ], + "shape": "donut" + } + }, + "title": "", + "type": "lens", + "visualizationType": "lnsPie" + }, + "description": "Utilization by different deployments types (or SKUs) that are available at model deployment time in the Azure AI Foundry resource.", + "enhancements": { + "dynamicActions": { + "events": [] + } + }, + "filters": [], + "query": { + "language": "kuery", + "query": "" + }, + "searchSessionId": "bf00eebd-c4ac-4941-9fea-fc45d194bf8c", + "syncColors": false, + "syncCursor": true, + "syncTooltips": false + }, + "gridData": { + "h": 9, + "i": "fdec5018-71ee-46cb-a628-2f40398c42da", + "w": 11, + "x": 0, + "y": 12 + }, + "panelIndex": "fdec5018-71ee-46cb-a628-2f40398c42da", + "title": "SKUs", + "type": "lens" + }, + { + "embeddableConfig": { + "attributes": { + "references": [ + { + "id": "logs-*", + "name": "indexpattern-datasource-layer-b8ec6c68-63cd-4217-a17e-a606012cad7f", + "type": "index-pattern" + } + ], + "state": { + "adHocDataViews": {}, + "datasourceStates": { + "formBased": { + "currentIndexPatternId": "logs-*", + "layers": { + "b8ec6c68-63cd-4217-a17e-a606012cad7f": { + "columnOrder": [ + "75687401-51b0-4e12-a647-081de03f931e", + "0ff8765b-affc-4cdc-a868-ad903337b305", + "881f4f6e-9d58-4cbf-b800-9f8c11048ef6" + ], + "columns": { + "0ff8765b-affc-4cdc-a868-ad903337b305": { + "dataType": "date", + "isBucketed": true, + "label": "@timestamp", + "operationType": "date_histogram", + "params": { + "dropPartials": false, + "includeEmptyRows": true, + "interval": "auto" + }, + "scale": "interval", + "sourceField": "@timestamp" + }, + "75687401-51b0-4e12-a647-081de03f931e": { + "dataType": "string", + "isBucketed": true, + "label": "Top 10 values of Model", + "operationType": "terms", + "params": { + "exclude": [], + "excludeIsRegex": false, + "include": [], + "includeIsRegex": false, + "missingBucket": false, + "orderBy": { + "columnId": "881f4f6e-9d58-4cbf-b800-9f8c11048ef6", + "type": "column" + }, + "orderDirection": "desc", + "otherBucket": true, + "parentFormat": { + "id": "terms" + }, + "size": 10 + }, + "scale": "ordinal", + "sourceField": "azure.ai_foundry.properties.backend_request_body.model" + }, + "881f4f6e-9d58-4cbf-b800-9f8c11048ef6": { + "customLabel": false, + "dataType": "number", + "isBucketed": false, + "label": "Average of azure.ai_foundry.duration_ms", + "operationType": "average", + "params": { + "emptyAsNull": true, + "format": { + "id": "duration", + "params": { + "compact": true, + "decimals": 2, + "fromUnit": "milliseconds", + "toUnit": "humanizePrecise" + } + } + }, + "scale": "ratio", + "sourceField": "azure.ai_foundry.duration_ms" + } + }, + "ignoreGlobalFilters": false, + "incompleteColumns": {}, + "indexPatternId": "logs-*", + "linkToLayers": [], + "sampling": 1 + } + } + } + }, + "filters": [], + "internalReferences": [], + "query": { + "language": "kuery", + "query": "" + }, + "visualization": { + "axisTitlesVisibilitySettings": { + "x": false, + "yLeft": false, + "yRight": false + }, + "fittingFunction": "Linear", + "gridlinesVisibilitySettings": { + "x": true, + "yLeft": true, + "yRight": true + }, + "labelsOrientation": { + "x": 0, + "yLeft": 0, + "yRight": 0 + }, + "layers": [ + { + "accessors": [ + "881f4f6e-9d58-4cbf-b800-9f8c11048ef6" + ], + "layerId": "b8ec6c68-63cd-4217-a17e-a606012cad7f", + "layerType": "data", + "seriesType": "line", + "splitAccessor": "75687401-51b0-4e12-a647-081de03f931e", + "xAccessor": "0ff8765b-affc-4cdc-a868-ad903337b305", + "yConfig": [ + { + "color": "#8583fc", + "forAccessor": "881f4f6e-9d58-4cbf-b800-9f8c11048ef6" + } + ] + } + ], + "legend": { + "isInside": false, + "isVisible": true, + "position": "bottom", + "showSingleSeries": false + }, + "preferredSeriesType": "bar_percentage_stacked", + "tickLabelsVisibilitySettings": { + "x": true, + "yLeft": true, + "yRight": true + }, + "valueLabels": "hide" + } + }, + "title": "", + "type": "lens", + "visualizationType": "lnsXY" + }, + "description": "Overall average latency by LLM models", + "enhancements": { + "dynamicActions": { + "events": [] + } + }, + "filters": [], + "query": { + "language": "kuery", + "query": "" + }, + "searchSessionId": "bf00eebd-c4ac-4941-9fea-fc45d194bf8c", + "syncColors": false, + "syncCursor": true, + "syncTooltips": false + }, + "gridData": { + "h": 9, + "i": "ce728ee7-8716-49a4-8a77-644894a78a47", + "w": 37, + "x": 11, + "y": 12 + }, + "panelIndex": "ce728ee7-8716-49a4-8a77-644894a78a47", + "title": "Latency - by model", + "type": "lens" + }, + { + "embeddableConfig": { + "attributes": { + "references": [ + { + "id": "logs-*", + "name": "indexpattern-datasource-layer-473e6010-87d8-4cf3-80ad-f8a900324b91", + "type": "index-pattern" + } + ], + "state": { + "adHocDataViews": {}, + "datasourceStates": { + "formBased": { + "currentIndexPatternId": "logs-*", + "layers": { + "473e6010-87d8-4cf3-80ad-f8a900324b91": { + "columnOrder": [ + "8ea8e229-b8d3-454d-9c8d-f9eab21b4a12", + "8544635c-fd87-40d7-83cf-27f6f8df0be1" + ], + "columns": { + "8544635c-fd87-40d7-83cf-27f6f8df0be1": { + "dataType": "number", + "isBucketed": false, + "label": "Count of records", + "operationType": "count", + "params": { + "emptyAsNull": true + }, + "scale": "ratio", + "sourceField": "___records___" + }, + "8ea8e229-b8d3-454d-9c8d-f9eab21b4a12": { + "dataType": "string", + "isBucketed": true, + "label": "Top 5 values of event.outcome", + "operationType": "terms", + "params": { + "exclude": [], + "excludeIsRegex": false, + "include": [], + "includeIsRegex": false, + "missingBucket": false, + "orderBy": { + "columnId": "8544635c-fd87-40d7-83cf-27f6f8df0be1", + "type": "column" + }, + "orderDirection": "desc", + "otherBucket": true, + "parentFormat": { + "id": "terms" + }, + "secondaryFields": [], + "size": 5 + }, + "scale": "ordinal", + "sourceField": "event.outcome" + } + }, + "incompleteColumns": {}, + "indexPatternId": "logs-*", + "sampling": 1 + } + } + }, + "indexpattern": { + "currentIndexPatternId": "logs-*", + "layers": {} + }, + "textBased": { + "indexPatternRefs": [ + { + "id": "logs-*", + "timeField": "@timestamp", + "title": "logs-*" + } + ], + "layers": {} + } + }, + "filters": [], + "internalReferences": [], + "query": { + "language": "kuery", + "query": "" + }, + "visualization": { + "layers": [ + { + "categoryDisplay": "hide", + "colorMapping": { + "assignments": [], + "colorMode": { + "type": "categorical" + }, + "paletteId": "default", + "specialAssignments": [ + { + "color": { + "type": "loop" + }, + "rule": { + "type": "other" + }, + "touched": false + } + ] + }, + "emptySizeRatio": 0.54, + "layerId": "473e6010-87d8-4cf3-80ad-f8a900324b91", + "layerType": "data", + "legendDisplay": "show", + "metrics": [ + "8544635c-fd87-40d7-83cf-27f6f8df0be1" + ], + "nestedLegend": false, + "numberDisplay": "percent", + "primaryGroups": [ + "8ea8e229-b8d3-454d-9c8d-f9eab21b4a12" + ], + "truncateLegend": true + } + ], + "shape": "donut" + } + }, + "title": "", + "type": "lens", + "visualizationType": "lnsPie" + }, + "description": "Information about the total successful or failure requests.", + "enhancements": { + "dynamicActions": { + "events": [] + } + }, + "filters": [], + "query": { + "language": "kuery", + "query": "" + }, + "searchSessionId": "bf00eebd-c4ac-4941-9fea-fc45d194bf8c", + "syncColors": false, + "syncCursor": true, + "syncTooltips": false + }, + "gridData": { + "h": 9, + "i": "e2b09a48-64ad-4779-989d-e88e14711759", + "w": 11, + "x": 0, + "y": 21 + }, + "panelIndex": "e2b09a48-64ad-4779-989d-e88e14711759", + "title": "Response type", + "type": "lens" + }, + { + "embeddableConfig": { + "attributes": { + "references": [ + { + "id": "logs-*", + "name": "indexpattern-datasource-layer-473e6010-87d8-4cf3-80ad-f8a900324b91", + "type": "index-pattern" + } + ], + "state": { + "adHocDataViews": {}, + "datasourceStates": { + "formBased": { + "currentIndexPatternId": "logs-*", + "layers": { + "473e6010-87d8-4cf3-80ad-f8a900324b91": { + "columnOrder": [ + "8ea8e229-b8d3-454d-9c8d-f9eab21b4a12", + "c1a321c2-2312-4304-a0c9-6021fde84c7b", + "8544635c-fd87-40d7-83cf-27f6f8df0be1" + ], + "columns": { + "8544635c-fd87-40d7-83cf-27f6f8df0be1": { + "customLabel": false, + "dataType": "number", + "isBucketed": false, + "label": "Count of records", + "operationType": "count", + "params": { + "emptyAsNull": true + }, + "scale": "ratio", + "sourceField": "___records___" + }, + "8ea8e229-b8d3-454d-9c8d-f9eab21b4a12": { + "dataType": "number", + "isBucketed": true, + "label": "Top 5 values of azure.ai_foundry.properties.backend_response_code", + "operationType": "terms", + "params": { + "exclude": [], + "excludeIsRegex": false, + "include": [], + "includeIsRegex": false, + "missingBucket": false, + "orderBy": { + "columnId": "8544635c-fd87-40d7-83cf-27f6f8df0be1", + "type": "column" + }, + "orderDirection": "desc", + "otherBucket": true, + "parentFormat": { + "id": "terms" + }, + "secondaryFields": [], + "size": 5 + }, + "scale": "ordinal", + "sourceField": "azure.ai_foundry.properties.backend_response_code" + }, + "c1a321c2-2312-4304-a0c9-6021fde84c7b": { + "dataType": "date", + "isBucketed": true, + "label": "@timestamp", + "operationType": "date_histogram", + "params": { + "dropPartials": false, + "includeEmptyRows": true, + "interval": "auto" + }, + "scale": "interval", + "sourceField": "@timestamp" + } + }, + "incompleteColumns": {}, + "indexPatternId": "logs-*", + "sampling": 1 + } + } + } + }, + "filters": [], + "internalReferences": [], + "query": { + "language": "kuery", + "query": "" + }, + "visualization": { + "axisTitlesVisibilitySettings": { + "x": true, + "yLeft": false, + "yRight": true + }, + "fittingFunction": "Linear", + "gridlinesVisibilitySettings": { + "x": true, + "yLeft": true, + "yRight": true + }, + "labelsOrientation": { + "x": 0, + "yLeft": 0, + "yRight": 0 + }, + "layers": [ + { + "accessors": [ + "8544635c-fd87-40d7-83cf-27f6f8df0be1" + ], + "colorMapping": { + "assignments": [], + "colorMode": { + "type": "categorical" + }, + "paletteId": "default", + "specialAssignments": [ + { + "color": { + "type": "loop" + }, + "rule": { + "type": "other" + }, + "touched": false + } + ] + }, + "layerId": "473e6010-87d8-4cf3-80ad-f8a900324b91", + "layerType": "data", + "seriesType": "bar_stacked", + "splitAccessor": "8ea8e229-b8d3-454d-9c8d-f9eab21b4a12", + "xAccessor": "c1a321c2-2312-4304-a0c9-6021fde84c7b" + } + ], + "legend": { + "isVisible": true, + "position": "bottom" + }, + "preferredSeriesType": "bar_percentage_stacked", + "tickLabelsVisibilitySettings": { + "x": true, + "yLeft": true, + "yRight": true + }, + "valueLabels": "hide" + } + }, + "title": "", + "type": "lens", + "visualizationType": "lnsXY" + }, + "description": "HTTP status code over time. Useful to track the 429 errors which is when the quota is exceeded.", + "enhancements": { + "dynamicActions": { + "events": [] + } + }, + "filters": [], + "query": { + "language": "kuery", + "query": "" + }, + "searchSessionId": "bf00eebd-c4ac-4941-9fea-fc45d194bf8c", + "syncColors": false, + "syncCursor": true, + "syncTooltips": false + }, + "gridData": { + "h": 9, + "i": "9e176e1b-215f-48f6-b877-5cad3bb08c46", + "w": 37, + "x": 11, + "y": 21 + }, + "panelIndex": "9e176e1b-215f-48f6-b877-5cad3bb08c46", + "title": "Response code", + "type": "lens" + } + ], + "timeRestore": false, + "title": "Azure AI Foundry Overview(API Management Service)", + "version": 3 + }, + "coreMigrationVersion": "8.8.0", + "created_at": "2025-06-26T13:21:06.819Z", + "created_by": "u_mGBROF_q5bmFCATbLXAcCwKa0k8JvONAwSruelyKA5E_0", + "id": "azure_ai_foundry-2b21bfb1-6fc2-45c5-9f0f-1e15aaab5245", + "references": [ + { + "id": "azure_ai_foundry-dd302b35-4d01-4269-aee8-aa56850135d9", + "name": "1777b180-02e0-4ad6-904e-137bf6a59c7c:panel_1777b180-02e0-4ad6-904e-137bf6a59c7c", + "type": "search" + }, + { + "id": "logs-*", + "name": "a1a2f0c4-40aa-4686-b066-265c64999c60:indexpattern-datasource-layer-b755cd44-08f2-4880-919d-864797dd4183", + "type": "index-pattern" + }, + { + "id": "logs-*", + "name": "a1a2f0c4-40aa-4686-b066-265c64999c60:indexpattern-datasource-layer-fae1c18e-dcef-40ee-95ed-dd853e3b167a", + "type": "index-pattern" + }, + { + "id": "logs-*", + "name": "3638b4c5-7ab9-494f-a796-40d854f3988c:layer_1_source_index_pattern", + "type": "index-pattern" + }, + { + "id": "logs-*", + "name": "1d795f37-34cc-4ff2-8dce-6feb3f77dd85:indexpattern-datasource-layer-473e6010-87d8-4cf3-80ad-f8a900324b91", + "type": "index-pattern" + }, + { + "id": "logs-*", + "name": "b368e5e4-a08e-4d85-904c-aabbd9cffc69:indexpattern-datasource-layer-473e6010-87d8-4cf3-80ad-f8a900324b91", + "type": "index-pattern" + }, + { + "id": "logs-*", + "name": "85057d86-e483-40af-9b6a-56d1f66e75fd:indexpattern-datasource-layer-b755cd44-08f2-4880-919d-864797dd4183", + "type": "index-pattern" + }, + { + "id": "logs-*", + "name": "85057d86-e483-40af-9b6a-56d1f66e75fd:indexpattern-datasource-layer-fae1c18e-dcef-40ee-95ed-dd853e3b167a", + "type": "index-pattern" + }, + { + "id": "logs-*", + "name": "573035b9-1c27-4fe3-9f23-7575d13146a1:indexpattern-datasource-layer-fae1c18e-dcef-40ee-95ed-dd853e3b167a", + "type": "index-pattern" + }, + { + "id": "logs-*", + "name": "573035b9-1c27-4fe3-9f23-7575d13146a1:indexpattern-datasource-layer-b755cd44-08f2-4880-919d-864797dd4183", + "type": "index-pattern" + }, + { + "id": "logs-*", + "name": "385d0db0-1e2b-42dc-b0b0-10c7a6c4c9d0:indexpattern-datasource-layer-b755cd44-08f2-4880-919d-864797dd4183", + "type": "index-pattern" + }, + { + "id": "logs-*", + "name": "385d0db0-1e2b-42dc-b0b0-10c7a6c4c9d0:indexpattern-datasource-layer-fae1c18e-dcef-40ee-95ed-dd853e3b167a", + "type": "index-pattern" + }, + { + "id": "logs-*", + "name": "fdec5018-71ee-46cb-a628-2f40398c42da:indexpattern-datasource-layer-473e6010-87d8-4cf3-80ad-f8a900324b91", + "type": "index-pattern" + }, + { + "id": "logs-*", + "name": "ce728ee7-8716-49a4-8a77-644894a78a47:indexpattern-datasource-layer-b8ec6c68-63cd-4217-a17e-a606012cad7f", + "type": "index-pattern" + }, + { + "id": "logs-*", + "name": "e2b09a48-64ad-4779-989d-e88e14711759:indexpattern-datasource-layer-473e6010-87d8-4cf3-80ad-f8a900324b91", + "type": "index-pattern" + }, + { + "id": "logs-*", + "name": "9e176e1b-215f-48f6-b877-5cad3bb08c46:indexpattern-datasource-layer-473e6010-87d8-4cf3-80ad-f8a900324b91", + "type": "index-pattern" + }, + { + "id": "logs-*", + "name": "controlGroup_4f0fa4ec-6864-4079-b243-2e1ddc243c48:optionsListDataView", + "type": "index-pattern" + }, + { + "id": "logs-*", + "name": "controlGroup_cca0b136-cf1f-44a3-953d-31caaae86a09:optionsListDataView", + "type": "index-pattern" + }, + { + "id": "logs-*", + "name": "controlGroup_21bc2bc8-c027-4bb9-b008-bd7030697f50:optionsListDataView", + "type": "index-pattern" + } + ], + "type": "dashboard", + "typeMigrationVersion": "10.2.0", + "updated_by": "u_mGBROF_q5bmFCATbLXAcCwKa0k8JvONAwSruelyKA5E_0" +} \ No newline at end of file diff --git a/packages/azure_ai_foundry/kibana/search/azure_ai_foundry-dd302b35-4d01-4269-aee8-aa56850135d9.json b/packages/azure_ai_foundry/kibana/search/azure_ai_foundry-dd302b35-4d01-4269-aee8-aa56850135d9.json new file mode 100644 index 00000000000..c5644d8c6e0 --- /dev/null +++ b/packages/azure_ai_foundry/kibana/search/azure_ai_foundry-dd302b35-4d01-4269-aee8-aa56850135d9.json @@ -0,0 +1,75 @@ +{ + "attributes": { + "columns": [ + "azure.ai_foundry.properties.backend_request_body.model", + "azure.ai_foundry.properties.backend_request_body.messages.content", + "azure.ai_foundry.properties.backend_response_body.choices.message.content", + "azure.ai_foundry.properties.backend_response_body.usage.input_tokens", + "azure.ai_foundry.properties.backend_response_body.usage.output_tokens", + "azure.ai_foundry.properties.backend_response_body.usage.total_tokens", + "azure.ai_foundry.is_request_success", + "azure.ai_foundry.properties.backend_response_body.choices.finish_reason" + ], + "description": "", + "grid": {}, + "hideChart": false, + "isTextBasedQuery": false, + "kibanaSavedObjectMeta": { + "searchSourceJSON": { + "filter": [ + { + "$state": { + "store": "appState" + }, + "meta": { + "alias": null, + "disabled": false, + "indexRefName": "kibanaSavedObjectMeta.searchSourceJSON.filter[0].meta.index", + "key": "azure.ai_foundry.category", + "negate": false, + "params": { + "query": "GatewayLogs" + }, + "type": "phrase" + }, + "query": { + "match_phrase": { + "azure.ai_foundry.category": "GatewayLogs" + } + } + } + ], + "indexRefName": "kibanaSavedObjectMeta.searchSourceJSON.index", + "query": { + "language": "kuery", + "query": "" + } + } + }, + "sort": [ + [ + "@timestamp", + "desc" + ] + ], + "timeRestore": false, + "title": "Prompt, response, token usage" + }, + "coreMigrationVersion": "8.8.0", + "created_at": "2025-06-27T06:47:01.025Z", + "id": "azure_ai_foundry-dd302b35-4d01-4269-aee8-aa56850135d9", + "references": [ + { + "id": "logs-*", + "name": "kibanaSavedObjectMeta.searchSourceJSON.index", + "type": "index-pattern" + }, + { + "id": "logs-*", + "name": "kibanaSavedObjectMeta.searchSourceJSON.filter[0].meta.index", + "type": "index-pattern" + } + ], + "type": "search", + "typeMigrationVersion": "10.5.0" +} \ No newline at end of file diff --git a/packages/azure_ai_foundry/manifest.yml b/packages/azure_ai_foundry/manifest.yml index cc9844be44d..ed1a99b3194 100644 --- a/packages/azure_ai_foundry/manifest.yml +++ b/packages/azure_ai_foundry/manifest.yml @@ -1,10 +1,10 @@ -format_version: 3.3.2 +format_version: "3.3.2" name: azure_ai_foundry title: "Azure AI Foundry" -version: "0.1.1" +version: "0.2.0" source: license: "Elastic-2.0" -description: "Collects Azure AI Foundry Metrics" +description: "Collects Azure AI Foundry logs and metrics" type: integration categories: - azure @@ -31,6 +31,10 @@ screenshots: title: Azure AI Foundry Overview size: 600x600 type: image/png + - src: /img/azure_ai_foundry_apim_overview.png + title: Azure AI Foundry Overview + size: 600x600 + type: image/png icons: - src: /img/ai_foundry.png title: Azure AI Foundry logo @@ -38,14 +42,19 @@ icons: type: image/svg+xml policy_templates: - name: azure_ai_foundry - title: Collects Azure AI Foundry metrics + title: Collects Azure AI Foundry logs and metrics description: Azure AI Foundry metrics with Elastic Agent. data_streams: + - logs - metrics categories: - azure - cloud inputs: + - type: "azure-eventhub" + title: "Collect Azure OpenAI logs from Event Hub" + description: "Collecting Azure AI Foundry logs from Azure (input: azure-eventhub)" + input_group: logs - type: "azure/metrics" title: "Collect Azure AI Foundry metrics" description: "Collecting Azure AI Foundry metrics"