in src/dotnet/AzureAI.Proxy/Services/LogIngestionService.cs [29:51]
public async Task LogAsync(LogAnalyticsRecord record)
{
try
{
_logger.LogInformation("Writing logs...");
var jsonContent = new List<LogAnalyticsRecord>();
jsonContent.Add(record);
//RBAC Monitoring Metrics Publisher needed
RequestContent content = RequestContent.Create(JsonSerializer.Serialize(jsonContent));
var ruleId = _config.GetSection("AzureMonitor")["DataCollectionRuleImmutableId"].ToString();
var stream = _config.GetSection("AzureMonitor")["DataCollectionRuleStream"].ToString();
Response response = await _logsIngestionClient.UploadAsync(ruleId, stream, content);
}
catch (Exception ex)
{
_logger.LogError($"Writing to LogAnalytics Failed: {ex.Message}");
}
}