logs-ehub-sink

所属分类:中间件编程
开发工具:C#
文件大小:0KB
下载次数:0
上传日期:2018-08-16 09:43:17
上 传 者sh-1993
说明:  演示使用Azure事件中心接收来自Azure服务的流式诊断日志的示例。天青福...,
(Sample that demonstrates the use of Azure Event Hubs to ingest streaming Diagnostic Logs originating from across Azure Services. Azure Functions is used to pick up the messages from Event Hubs and send them to a custom REST API)

文件列表:
Azure Functions code/ (0, 2018-08-16)
Azure Functions code/Project.json (384, 2018-08-16)
Azure Functions code/run.cs (1843, 2018-08-16)
Diagnostic log messages/ (0, 2018-08-16)
Diagnostic log messages/AzureSearchLogs.json (1452, 2018-08-16)
Diagnostic log messages/CosmosLogs.json (8403, 2018-08-16)
custom REST Service/ (0, 2018-08-16)
custom REST Service/LogReceiverService.sln (1128, 2018-08-16)
custom REST Service/LogReceiverService/ (0, 2018-08-16)
custom REST Service/LogReceiverService/Connected Services/ (0, 2018-08-16)
custom REST Service/LogReceiverService/Connected Services/Application Insights/ (0, 2018-08-16)
custom REST Service/LogReceiverService/Connected Services/Application Insights/ConnectedService.json (219, 2018-08-16)
custom REST Service/LogReceiverService/Controllers/ (0, 2018-08-16)
custom REST Service/LogReceiverService/Controllers/LogReceiverController.cs (2835, 2018-08-16)
custom REST Service/LogReceiverService/Controllers/ValuesController.cs (930, 2018-08-16)
custom REST Service/LogReceiverService/LogReceiverService.csproj (1161, 2018-08-16)
custom REST Service/LogReceiverService/Program.cs (652, 2018-08-16)
custom REST Service/LogReceiverService/Properties/ (0, 2018-08-16)
custom REST Service/LogReceiverService/Properties/PublishProfiles/ (0, 2018-08-16)
custom REST Service/LogReceiverService/Properties/PublishProfiles/LogReceiverService20180811092438 - Web Deploy.pubxml (1684, 2018-08-16)
custom REST Service/LogReceiverService/Properties/launchSettings.json (697, 2018-08-16)
custom REST Service/LogReceiverService/Startup.cs (1144, 2018-08-16)
custom REST Service/LogReceiverService/appsettings.Development.json (168, 2018-08-16)
custom REST Service/LogReceiverService/appsettings.json (297, 2018-08-16)
custom REST Service/LogReceiverService/models/ (0, 2018-08-16)
custom REST Service/LogReceiverService/models/CommonSchemaObject.cs (960, 2018-08-16)
custom REST Service/LogReceiverService/models/CosmosDBLogs.cs (1464, 2018-08-16)
custom REST Service/LogReceiverService/models/SearchLogs.cs (1141, 2018-08-16)
images/ (0, 2018-08-16)
images/appinsights.PNG (266365, 2018-08-16)
images/eventhubview.PNG (190170, 2018-08-16)
images/functionapp.PNG (163875, 2018-08-16)
images/kuduconsole.PNG (155195, 2018-08-16)

# logs-ehub-sink Sample demonstrates the use of Azure Event Hubs to ingest streaming Diagnostic Logs that originate from across different Azure Services. Azure Functions uses an input trigger from Event Hubs to pick the log messages and sends them to a custom REST Service ## Streaming diagnostic logs from Azure Monitor Diagnostic logs from different Azure Services can be streamed to Log Analytics, or to Azure Event Hubs, using Azure Monitor. This article - https://docs.microsoft.com/en-us/azure/monitoring-and-diagnostics/monitoring-stream-diagnostic-logs-to-event-hubs - has the guidance. For this sample, Azure Monitor was configured to stream logs from a Cosmos DB Service and Azure Search Service. An Event Hub namespace + Event Hub endpoint have to exist to complete the above step. After configuring the diagnostics, navigate to the Event Hub end point and in the metrics view, ensure the 'Messages' part shows incoming messages. The outgoing messages metrics will show up only after client consumers (Azure Functions in this example) are configured. drawing ## Deploy the custom REST Service to receive the logs from Azure Functions This is a simple ASP.NET Core 2.0 Web API project that will receive the Logs coming in from Azure Functions (configured in the next section below). This is to mimic a third party Solution that would want to handle Diagnostic logs. The Visual Studio 2017 Project for this REST Service 'LogReceiverService' is included in this repository. This custom code uses Application Insights to send the trace information. To view the telemetry when running this sample, create an Application Inisights resource in Azure, and enter its Security key inside the appsettings.json file of the Project. Publish this Project to a Web App in Azure. The URL of the LogReceiverController Service would be required in the next section below, in the Function App. The REST Service deserializes the incoming Diagnostic log messages based on the common schema definition, that applies to all the Azure Services. In the property attribute of the Message, attributes specific and unique to each Azure Service are captured. Refer to this link - https://docs.microsoft.com/en-us/azure/monitoring-and-diagnostics/monitoring-diagnostic-logs-schema for details of the common schema. ## Create an Azure Function (Event Hub Consumer) Create a new Azure Function App (version 1.x is used in this example) and configure an input trigger on the EVent Hub created in the earlier steps. This link https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-first-azure-function pertains to configuring a HTTP Trigger, but the steps for Event Hub input triggers are similar. Copy the code from folder "Azure Functions Code\run.cs", available in this repository, into the Function app's run.csx editor in the Azure Portal. Since this code depends on additional packages to run, create a Project.JSON file in the Kudu console of the Function App, and copy the content of the Project.json file included in this repository. After it is saved, restart the Function App from the Azure Portal. Ensure the Log console on the Function's run.csx file indicates it has successfully compiled and is running. The Messages from Event Hubs should start showing up in this console after some time. drawing Update the URL of the custom REST Service in the run.csx to send the Messages to (from the previous section). Refer to these links below to understand how to develop applications using Azure Functions. https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference#fileupdate https://docs.microsoft.com/en-us/azure/azure-functions/functions-develop-local drawing ## View the Application Insights Telemetry View the Trace in Application Insights to ensure the Diagnostics Logs were received from the Function App. drawing

近期下载者

相关文件


收藏者