コード例 #1
0
 protected override void ProcessRecord()
 {
     base.ProcessRecord();
     try
     {
         client?.Dispose();
         int timeout = GetPreferredTimeout();
         WriteDebug($"Cmdlet Timeout : {timeout} milliseconds.");
         client = new LogAnalyticsClient(AuthProvider, new Oci.Common.ClientConfiguration
         {
             RetryConfiguration = retryConfig,
             TimeoutMillis      = timeout,
             ClientUserAgent    = PSUserAgent
         });
         string region = GetPreferredRegion();
         if (region != null)
         {
             WriteDebug("Choosing Region:" + region);
             client.SetRegion(region);
         }
         if (Endpoint != null)
         {
             WriteDebug("Choosing Endpoint:" + Endpoint);
             client.SetEndpoint(Endpoint);
         }
     }
     catch (Exception ex)
     {
         TerminatingErrorDuringExecution(ex);
     }
 }
        public async Task WhenSendingQueryWithEmptyResultsThenResultsAreAsExpected()
        {
            var client = new LogAnalyticsClient(this.tracerMock.Object, new TestHttpClientWrapper(emptyResults: true), this.credentialsFactoryMock.Object, new Uri("https://dummy.query.com"), TimeSpan.FromMinutes(10));
            IList <DataTable> results = await client.RunQueryAsync(Query, DataTimeSpan, default(CancellationToken));

            VerifyDataTables(new List <DataTable>(), results);
        }
        protected void ExecuteLogAnalyticExportThrottledRequestsMethod(object[] invokeMethodInputParameters)
        {
            var parameters            = new ThrottledRequestsInput();
            var pGroupByOperationName = (bool?)ParseParameter(invokeMethodInputParameters[0]);

            parameters.GroupByOperationName = pGroupByOperationName;
            var pFromTime = (DateTime)ParseParameter(invokeMethodInputParameters[1]);

            parameters.FromTime = pFromTime;
            var pGroupByThrottlePolicy = (bool?)ParseParameter(invokeMethodInputParameters[2]);

            parameters.GroupByThrottlePolicy = pGroupByThrottlePolicy;
            var pBlobContainerSasUri = (string)ParseParameter(invokeMethodInputParameters[3]);

            parameters.BlobContainerSasUri = pBlobContainerSasUri;
            var pGroupByResourceName = (bool?)ParseParameter(invokeMethodInputParameters[4]);

            parameters.GroupByResourceName = pGroupByResourceName;
            var pToTime = (DateTime)ParseParameter(invokeMethodInputParameters[5]);

            parameters.ToTime = pToTime;
            string location = (string)ParseParameter(invokeMethodInputParameters[7]);

            var result = LogAnalyticsClient.ExportThrottledRequests(parameters, location);

            WriteObject(result);
        }
        public async Task WhenSendingQueryWithInvalidTypeThenAnExceptionIsThrown()
        {
            var client = new LogAnalyticsClient(this.tracerMock.Object, new TestHttpClientWrapper(invalidType: true), this.credentialsFactoryMock.Object, new Uri("https://dummy.query.com"), TimeSpan.FromMinutes(10));
            IList <DataTable> results = await client.RunQueryAsync(Query, DataTimeSpan, default(CancellationToken));

            VerifyDataTables(TestHttpClientWrapper.GetExpectedResults(), results);
        }
        public override void ExecuteCmdlet()
        {
            base.ExecuteCmdlet();
            ExecuteClientAction(() =>
            {
                if (ShouldProcess(this.Location, VerbsData.Export))
                {
                    var parameters = new ThrottledRequestsInput();
                    parameters.GroupByOperationName = this.GroupByOperationName;
                    parameters.BlobContainerSasUri  = this.BlobContainerSasUri;
                    parameters.FromTime             = this.FromTime;
                    parameters.ToTime = this.ToTime;
                    parameters.GroupByResourceName   = this.GroupByResourceName;
                    parameters.GroupByThrottlePolicy = this.GroupByThrottlePolicy;
                    string location = this.Location.Canonicalize();

                    if (NoWait.IsPresent)
                    {
                        var result   = LogAnalyticsClient.BeginExportThrottledRequests(parameters, location);
                        var psObject = new PSLogAnalyticsOperationResult();
                        ComputeAutomationAutoMapperProfile.Mapper.Map <LogAnalyticsOperationResult, PSLogAnalyticsOperationResult>(result, psObject);
                        WriteObject(psObject);
                    }
                    else
                    {
                        var result   = LogAnalyticsClient.ExportThrottledRequests(parameters, location);
                        var psObject = new PSLogAnalyticsOperationResult();
                        ComputeAutomationAutoMapperProfile.Mapper.Map <LogAnalyticsOperationResult, PSLogAnalyticsOperationResult>(result, psObject);
                        WriteObject(psObject);
                    }
                }
            });
        }
コード例 #6
0
        private LogAnalyticsClient GetLogAnalyticsClient()
        {
            LogAnalyticsClient logger = new LogAnalyticsClient(
                workspaceId: logininfo.OmsWorkSpaceID,
                sharedKey: logininfo.OmsSharedKey);

            return(logger);
        }
コード例 #7
0
        public void SendLogEntries_ThrowsAggregateException_IfEntityIsNull()
        {
            // Arrange.
            LogAnalyticsClient client = new LogAnalyticsClient("id", "bXlTaGFyZWRLZXk=");

            // Act.
            void act() => client.SendLogEntries <ValidTestEntity>(null, "logtype").Wait();

            // Assert.
            Assert.Throws <AggregateException>(act);
        }
コード例 #8
0
        public void SendLogEntry_ThrowsArgumentOutOfRangeException_IfLogTypeLengthIsExceeded()
        {
            // Arrange.
            LogAnalyticsClient client = new LogAnalyticsClient("id", "bXlTaGFyZWRLZXk=");

            // Act.
            void act() => client.SendLogEntry <ValidTestEntity>(new ValidTestEntity(), "aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeeeaaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeeeZ");

            // Assert.
            Assert.Throws <ArgumentOutOfRangeException>(act);
        }
コード例 #9
0
        public void SendLogEntry_ThrowsArgumentOutOfRangeException_IfInvalidEntity()
        {
            // Arrange.
            LogAnalyticsClient client = new LogAnalyticsClient("id", "bXlTaGFyZWRLZXk=");

            // Act.
            void act() => client.SendLogEntry <InvalidTestEntity>(new InvalidTestEntity(), "logtype");

            // Assert.
            Assert.Throws <ArgumentOutOfRangeException>(act);
        }
コード例 #10
0
        public void SendLogEntry_ThrowsArgumentOutOfRangeException_IfLogTypeIsNullOrEmpty(string logType)
        {
            // Arrange.
            LogAnalyticsClient client = new LogAnalyticsClient("id", "bXlTaGFyZWRLZXk=");

            // Act.
            void act() => client.SendLogEntry <ValidTestEntity>(new ValidTestEntity(), logType);

            // Assert.
            Assert.Throws <ArgumentNullException>(act);
        }
コード例 #11
0
        public void SendLogEntry_ThrowsArgumentOutOfRangeException_IfLogTypeContainsAnythingExceptAlphanumericOrUnderscoreCharacters(string logType)
        {
            // Arrange.
            LogAnalyticsClient client = new LogAnalyticsClient("id", "bXlTaGFyZWRLZXk=");

            // Act.
            void act() => client.SendLogEntry <ValidTestEntity>(new ValidTestEntity(), logType);

            // Assert.
            Assert.Throws <ArgumentOutOfRangeException>(act);
        }
        public async Task WhenCreatingLogAnalyticsClientForSomeResourceThenTheCorrectClientIsCreated()
        {
            var resource = new ResourceIdentifier(ResourceType.VirtualMachine, SubscriptionId, ResourceGroupName, ResourceName);

            IAnalysisServicesFactory factory = new AnalysisServicesFactory(this.tracerMock.Object, this.httpClientWrapperMock.Object, this.credentialsFactoryMock.Object, this.azureResourceManagerClientMock.Object);
            LogAnalyticsClient       client  = await factory.CreateLogAnalyticsClientAsync(resource, default(CancellationToken)) as LogAnalyticsClient;

            Assert.IsNotNull(client);
            Assert.AreEqual(
                new Uri($"https://api.loganalytics.io/v1/subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/virtualMachines/{ResourceName}/query"),
                client.QueryUri,
                "Wrong query URI");
        }
        public async Task WhenCreatingLogAnalyticsClientForLogAnalyticsWorkspaceResourceThenTheCorrectClientIsCreated()
        {
            var resource = new ResourceIdentifier(ResourceType.LogAnalytics, SubscriptionId, ResourceGroupName, ResourceName);

            this.azureResourceManagerClientMock
            .Setup(m => m.GetLogAnalyticsWorkspaceIdAsync(resource, default(CancellationToken)))
            .ReturnsAsync("testWorkspaceId");

            IAnalysisServicesFactory factory = new AnalysisServicesFactory(this.tracerMock.Object, this.httpClientWrapperMock.Object, this.credentialsFactoryMock.Object, this.azureResourceManagerClientMock.Object);
            LogAnalyticsClient       client  = await factory.CreateLogAnalyticsClientAsync(resource, default(CancellationToken)) as LogAnalyticsClient;

            Assert.IsNotNull(client);
            Assert.AreEqual(new Uri("https://api.loganalytics.io/v1/workspaces/testWorkspaceId/query"), client.QueryUri, "Wrong query URI");
        }
        public async Task WhenQueryReturnsAnErrorThenTheCorrectExceptionIsThrown()
        {
            var client = new LogAnalyticsClient(this.tracerMock.Object, new TestHttpClientWrapper(error: true), this.credentialsFactoryMock.Object, new Uri("https://dummy.query.com"), TimeSpan.FromMinutes(10));

            try
            {
                await client.RunQueryAsync(Query, DataTimeSpan, default(CancellationToken));

                Assert.Fail("An exception should have been thrown");
            }
            catch (TelemetryDataClientException e)
            {
                Assert.AreEqual($"[test error code] test error message", e.Message, "Exception message mismatch");
                Assert.IsNull(e.InnerException, "Inner exception is not null");
            }
        }
コード例 #15
0
        public void SendLogMessageTest()
        {
            LogAnalyticsClient logger = new LogAnalyticsClient(
                workspaceId: _secrets.LawSecrets.LawId,
                sharedKey: _secrets.LawSecrets.LawKey);

            // after this is sent, wait a couple of minutes and then check your Log Analytics dashboard.
            // todo: if you want a true integration test, wait for it here, then query the logs from code and verify that the entries are there, then assert the test.
            logger.SendLogEntry(new TestEntity
            {
                Category     = GetCategory(),
                TestString   = $"String Test",
                TestBoolean  = true,
                TestDateTime = DateTime.UtcNow,
                TestDouble   = 2.1,
                TestGuid     = Guid.NewGuid()
            }, "demolog").Wait();
        }
コード例 #16
0
        public static void Init(TestContext context)
        {
            // Wire up test secrets.
            _secrets = InitSecrets();

            // Get a data client, helping us actually Read data, too.
            _dataClient = GetLawDataClient(_secrets.LawSecrets.LawId, _secrets.LawPrincipalCredentials.ClientId, _secrets.LawPrincipalCredentials.ClientSecret, _secrets.LawPrincipalCredentials.Domain).Result;

            // Set up unique identifiers for the tests. This helps us query the Log Analytics Workspace for our specific messages, and ensure the count and properties are correctly shipped to the logs.
            testIdentifierEntries = $"test-id-{Guid.NewGuid()}";
            testIdentifierEntry   = $"test-id-{Guid.NewGuid()}";

            // Initialize the LAW Client.
            LogAnalyticsClient logger = new LogAnalyticsClient(
                workspaceId: _secrets.LawSecrets.LawId,
                sharedKey: _secrets.LawSecrets.LawKey);

            // Test 1 prep: Push a collection of entities to the logs.
            List <DemoEntity> entities = new List <DemoEntity>();

            for (int ii = 0; ii < 12; ii++)
            {
                entities.Add(new DemoEntity
                {
                    Criticality  = "e2ecriticality",
                    Message      = testIdentifierEntries,
                    SystemSource = "e2etest"
                });
            }

            logger.SendLogEntries(entities, "endtoendlogs").Wait();


            // Test 2 prep: Send a single entry to the logs.
            logger.SendLogEntry(new DemoEntity
            {
                Criticality  = "e2ecriticalitysingleentry",
                Message      = testIdentifierEntry,
                SystemSource = "e2etestsingleentry"
            }, "endtoendlogs").Wait();

            // Since it takes a while before the logs are queryable, we'll sit tight and wait for a few minutes before we launch the retrieval-tests.
            Thread.Sleep(6 * 1000 * 60);
        }
コード例 #17
0
        public void SendBadEntity_Test()
        {
            LogAnalyticsClient logger = new LogAnalyticsClient(
                workspaceId: _secrets.LawSecrets.LawId,
                sharedKey: _secrets.LawSecrets.LawKey);

            List <TestEntityBadProperties> entities = new List <TestEntityBadProperties>();

            for (int ii = 0; ii < 1; ii++)
            {
                entities.Add(new TestEntityBadProperties
                {
                    MyCustomProperty = new MyCustomClass
                    {
                        MyString = "hello world",
                    }
                });
            }

            Assert.ThrowsException <AggregateException>(() => logger.SendLogEntries(entities, "testlog").Wait());
        }
コード例 #18
0
        public void SendDemoEntities_Test()
        {
            LogAnalyticsClient logger = new LogAnalyticsClient(
                workspaceId: _secrets.LawSecrets.LawId,
                sharedKey: _secrets.LawSecrets.LawKey);

            List <DemoEntity> entities = new List <DemoEntity>();

            for (int ii = 0; ii < 5000; ii++)
            {
                entities.Add(new DemoEntity
                {
                    Criticality  = GetCriticality(),
                    Message      = "lorem ipsum dolor sit amet",
                    SystemSource = GetSystemSource()
                });
            }

            // after this is sent, wait a couple of minutes and then check your Log Analytics dashboard.
            // todo: if you want a true integration test, wait for it here, then query the logs from code and verify that the entries are there, then assert the test.
            logger.SendLogEntries(entities, "demolog").Wait();
        }
コード例 #19
0
        public void SendDemoEntities_Test()
        {
            LogAnalyticsClient logger = new LogAnalyticsClient(
                workspaceId: _secrets.LawSecrets.LawId,
                sharedKey: _secrets.LawSecrets.LawKey);

            List <DemoEntity> entities = new List <DemoEntity>();

            for (int ii = 0; ii < 5000; ii++)
            {
                entities.Add(new DemoEntity
                {
                    Criticality  = GetCriticality(),
                    Message      = "lorem ipsum dolor sit amet",
                    SystemSource = GetSystemSource(),
                    Priority     = 2
                });
            }

            // after this is sent, wait a couple of minutes and then check your Log Analytics dashboard.
            logger.SendLogEntries(entities, "demolog").Wait();
        }
コード例 #20
0
        public void SendDemoEvents_Test()
        {
            LogAnalyticsClient logger = new LogAnalyticsClient(
                workspaceId: _secrets.LawSecrets.LawId,
                sharedKey: _secrets.LawSecrets.LawKey);

            // SECURITY EVENTS (Sample/Demo code only)
            List <CustomSecurityEvent> securityEntities = new List <CustomSecurityEvent>();
            int securityRandom = RandomNumberGenerator.GetInt32(100, 12000); // amount of randomized log events to ship.

            for (int ii = 0; ii < securityRandom; ii++)
            {
                securityEntities.Add(new CustomSecurityEvent
                {
                    Severity = GetSeverity(),
                    Source   = Environment.MachineName,
                    Message  = GetRandomMessageForTest()
                });
            }

            logger.SendLogEntries(securityEntities, "customsecurity").Wait();

            // AUDIT EVENTS (Sample/Demo code only)
            List <CustomAuditEvent> auditEntities = new List <CustomAuditEvent>();
            int auditRandom = RandomNumberGenerator.GetInt32(250, 5000);;  // amount of randomized log events to ship.

            for (int ii = 0; ii < auditRandom; ii++)
            {
                auditEntities.Add(new CustomAuditEvent
                {
                    Severity = GetSeverity(),
                    Source   = Environment.MachineName,
                    Message  = GetRandomMessageForTest()
                });
            }

            logger.SendLogEntries(auditEntities, "customaudit").Wait();
        }
コード例 #21
0
        public override void ExecuteCmdlet()
        {
            ExecuteClientAction(() =>
            {
                if (ShouldProcess(this.Location, VerbsData.Export))
                {
                    var parameters                   = new RequestRateByIntervalInput();
                    parameters.FromTime              = this.FromTime;
                    parameters.GroupByOperationName  = this.GroupByOperationName;
                    parameters.IntervalLength        = this.IntervalLength;
                    parameters.GroupByThrottlePolicy = this.GroupByThrottlePolicy;
                    parameters.BlobContainerSasUri   = this.BlobContainerSasUri;
                    parameters.GroupByResourceName   = this.GroupByResourceName;
                    parameters.ToTime                = this.ToTime;
                    string location                  = this.Location.Canonicalize();

                    var result   = LogAnalyticsClient.ExportRequestRateByInterval(parameters, location);
                    var psObject = new PSLogAnalyticsOperationResult();
                    ComputeAutomationAutoMapperProfile.Mapper.Map <LogAnalyticsOperationResult, PSLogAnalyticsOperationResult>(result, psObject);
                    WriteObject(psObject);
                }
            });
        }
        public override void ExecuteCmdlet()
        {
            base.ExecuteCmdlet();
            ExecuteClientAction(() =>
            {
                if (ShouldProcess(this.Location, VerbsData.Export))
                {
                    var parameters = new RequestRateByIntervalInput();
                    parameters.GroupByOperationName = this.GroupByOperationName;
                    parameters.BlobContainerSasUri  = this.BlobContainerSasUri;
                    parameters.IntervalLength       = this.IntervalLength;
                    parameters.FromTime             = this.FromTime;
                    parameters.ToTime = this.ToTime;
                    parameters.GroupByResourceName        = this.GroupByResourceName;
                    parameters.GroupByThrottlePolicy      = this.GroupByThrottlePolicy;
                    parameters.GroupByClientApplicationId = this.GroupByApplicationId;
                    parameters.GroupByUserAgent           = this.GroupByUserAgent;
                    string location = this.Location.Canonicalize();

                    if (NoWait.IsPresent)
                    {
                        var result   = LogAnalyticsClient.BeginExportRequestRateByInterval(parameters, location);
                        var psObject = new PSLogAnalyticsOperationResult();
                        ComputeAutomationAutoMapperProfile.Mapper.Map <LogAnalyticsOperationResult, PSLogAnalyticsOperationResult>(result, psObject);
                        WriteObject(psObject);
                    }
                    else
                    {
                        var result   = LogAnalyticsClient.ExportRequestRateByInterval(parameters, location);
                        var psObject = new PSLogAnalyticsOperationResult();
                        ComputeAutomationAutoMapperProfile.Mapper.Map <LogAnalyticsOperationResult, PSLogAnalyticsOperationResult>(result, psObject);
                        WriteObject(psObject);
                    }
                    WriteWarning("Please go to https://aka.ms/throttledRequest to learn more about this cmdlet.");
                }
            });
        }
コード例 #23
0
 public WeatherForecastController(LogAnalyticsClient logger)
 {
     _logger = logger;
 }
コード例 #24
0
 public WeatherForecastService(LogAnalyticsClient logger)
 {
     _logger = logger;
 }
コード例 #25
0
 public LogAnalyticsWaiters(LogAnalyticsClient client)
 {
     this.client = client;
 }
コード例 #26
0
        public static void Init(TestContext context)
        {
            // Wire up test secrets.
            _secrets = InitSecrets();

            // Get a data client, helping us actually Read data, too.
            _dataClient = GetLawDataClient(
                _secrets.LawSecrets.LawId,
                _secrets.LawPrincipalCredentials.ClientId,
                _secrets.LawPrincipalCredentials.ClientSecret,
                _secrets.LawPrincipalCredentials.Domain)
                          .Result;

            // Set up unique identifiers for the tests. This helps us query the Log Analytics Workspace for our specific messages, and ensure the count and properties are correctly shipped to the logs.
            testIdentifierEntries       = $"test-id-{Guid.NewGuid()}";
            testIdentifierEntry         = $"test-id-{Guid.NewGuid()}";
            testIdentifierEncodingEntry = $"test-id-{Guid.NewGuid()}-ÅÄÖ@~#$%^&*()123";
            testIdentifierNullableEntry = $"test-id-{Guid.NewGuid()}";

            // Initialize the LAW Client.
            LogAnalyticsClient logger = new LogAnalyticsClient(
                workspaceId: _secrets.LawSecrets.LawId,
                sharedKey: _secrets.LawSecrets.LawKey);

            // Test 1 prep: Push a collection of entities to the logs.
            List <DemoEntity> entities = new List <DemoEntity>();

            for (int ii = 0; ii < 12; ii++)
            {
                entities.Add(new DemoEntity
                {
                    Criticality  = "e2ecriticality",
                    Message      = testIdentifierEntries,
                    SystemSource = "e2etest",
                    Priority     = int.MaxValue - 1
                });
            }
            logger.SendLogEntries(entities, "endtoendlogs").Wait();


            // Test 2 prep: Send a single entry to the logs.
            logger.SendLogEntry(new DemoEntity
            {
                Criticality  = "e2ecriticalitysingleentry",
                Message      = testIdentifierEntry,
                SystemSource = "e2etestsingleentry",
                Priority     = int.MinValue + 1
            }, "endtoendlogs");

            // Since it takes a while before the logs are queryable, we'll sit tight and wait for a few minutes before we launch the retrieval-tests.

            // Test 3 prep: Verify that different encoding types work
            var encodingTestEntity = new DemoEntity
            {
                Criticality  = "e2ecriticalityencoding",
                Message      = $"{testIdentifierEncodingEntry}", // Special encoding test.
                SystemSource = "e2etestencoding",
                Priority     = int.MaxValue - 10000
            };

            logger.SendLogEntry(encodingTestEntity, "endtoendlogs");

            // Test 4 prep: Verify that nullable entries work
            var nullableTestEntity = new NullableDemoEntity
            {
                Message   = $"{testIdentifierNullableEntry}",
                NoValue   = null,
                WithValue = int.MaxValue - 20000
            };

            logger.SendLogEntry(nullableTestEntity, "endtoendlogs");


            Thread.Sleep(6 * 1000 * 60);
        }
コード例 #27
0
        public static void Init(TestContext context)
        {
            // Wire up test secrets.
            _secrets = TestsBase.InitSecrets();

            // Get a data client, helping us actually Read data, too.
            _dataClient = LawDataClientHelper.GetLawDataClient(
                _secrets.LawSecrets.LawId,
                _secrets.LawPrincipalCredentials.ClientId,
                _secrets.LawPrincipalCredentials.ClientSecret,
                _secrets.LawPrincipalCredentials.Domain)
                          .Result;

            // Set up unique identifiers for the tests. This helps us query the Log Analytics Workspace for our specific messages, and ensure the count and properties are correctly shipped to the logs.
            testIdentifierEntries       = $"test-id-{Guid.NewGuid()}";
            testIdentifierEntry         = $"test-id-{Guid.NewGuid()}";
            testIdentifierEncodingEntry = $"test-id-{Guid.NewGuid()}-ÅÄÖ@~#$%^&*()123";
            testIdentifierNullableEntry = $"test-id-{Guid.NewGuid()}";
            testIdentifierLogTypeEntry  = $"test-id-{Guid.NewGuid()}";
            diTestId = $"test-id-di-{Guid.NewGuid()}";


            // Initialize the LAW Client.
            LogAnalyticsClient logger = new LogAnalyticsClient(
                workspaceId: _secrets.LawSecrets.LawId,
                sharedKey: _secrets.LawSecrets.LawKey);

            // Test 1 prep: Push a collection of entities to the logs.
            List <DemoEntity> entities = new List <DemoEntity>();

            for (int ii = 0; ii < 12; ii++)
            {
                entities.Add(new DemoEntity
                {
                    Criticality  = "e2ecriticality",
                    Message      = testIdentifierEntries,
                    SystemSource = "e2etest",
                    Priority     = int.MaxValue - 1
                });
            }
            logger.SendLogEntries(entities, "endtoendlogs").Wait();


            // Test 2 prep: Send a single entry to the logs.
            logger.SendLogEntry(new DemoEntity
            {
                Criticality  = "e2ecriticalitysingleentry",
                Message      = testIdentifierEntry,
                SystemSource = "e2etestsingleentry",
                Priority     = int.MinValue + 1
            }, "endtoendlogs");

            // Since it takes a while before the logs are queryable, we'll sit tight and wait for a few minutes before we launch the retrieval-tests.

            // Test 3 prep: Verify that different encoding types work
            var encodingTestEntity = new DemoEntity
            {
                Criticality  = "e2ecriticalityencoding",
                Message      = $"{testIdentifierEncodingEntry}", // Special encoding test.
                SystemSource = "e2etestencoding",
                Priority     = int.MaxValue - 10000
            };

            logger.SendLogEntry(encodingTestEntity, "endtoendlogs");

            // Test 4 prep: Verify that nullable entries work
            var nullableTestEntity = new NullableDemoEntity
            {
                Message   = $"{testIdentifierNullableEntry}",
                NoValue   = null,
                WithValue = int.MaxValue - 20000
            };

            logger.SendLogEntry(nullableTestEntity, "endtoendlogs");


            // Test 5 prep: Verify we can use AlphaNum + Underscore for Log-Type.
            var logTypeTestEntity = new DemoEntity
            {
                Criticality  = "Critical",
                Message      = testIdentifierLogTypeEntry,
                Priority     = int.MaxValue - 1,
                SystemSource = "logtypetest"
            };

            logger.SendLogEntry(logTypeTestEntity, "log_name_123");

            //
            // DI LOGGER
            //
            var provider = new ServiceCollection()
                           .AddLogAnalyticsClient(c =>
            {
                c.WorkspaceId = _secrets.LawSecrets.LawId;
                c.SharedKey   = _secrets.LawSecrets.LawKey;
            }).BuildServiceProvider();

            var diLogger = provider.GetRequiredService <LogAnalyticsClient>();

            // Send a log entry to verify it works.
            diLogger.SendLogEntry(new DemoEntity
            {
                Criticality  = "e2ecritical",
                Message      = diTestId,
                SystemSource = "e2ewithdi",
                Priority     = int.MinValue + 1
            }, "endtoendwithdilogs");


            // Unfortunately, from the time we send the logs, until they appear in LAW, takes a few minutes.
            Thread.Sleep(8 * 1000 * 60);
        }