user3622142 user3622142 - 25 days ago 10
C# Question

C# Live data for each tail

I'm playing with live data. The problem is that it grabs the data at the time executing and display all the data (using foreach). But the time of executing, there is new data that the application hasnt got.

I want the application to continue getting data, but I don't know how to approach this?

public static void Main(string[] args)
{
MainAsync(args).Wait();
}

public static async Task MainAsync(string[] args)
{

var credentials = azureLogin;
var client = new OperationalInsightsManagementClient(credentials);
client.SubscriptionId = subscriptionId;


var searchResult = await client.Workspaces.GetSearchResultsAsync(resourceGroupName, workspeceName, parameters);
foreach (var result in searchResult.Value)
{
Console.WriteLine(result.ToString());
}
Console.ReadLine();
}

Answer Source

Check the parameters variable, it contains arguments like end, start and top. Use these to specify the rows you want to load instead of loading all rows. Then you load only N rows at a time with a loop.