{"id":23463714,"url":"https://github.com/ptv-logistics/log4ala","last_synced_at":"2025-04-14T08:14:53.025Z","repository":{"id":70614356,"uuid":"90880974","full_name":"ptv-logistics/Log4ALA","owner":"ptv-logistics","description":"Log4Net appender for Azure Log Analytics","archived":false,"fork":false,"pushed_at":"2025-04-07T14:24:53.000Z","size":3200,"stargazers_count":10,"open_issues_count":1,"forks_count":6,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-04-07T14:35:45.676Z","etag":null,"topics":["azure","azure-log-analytics","csharp","log-analytics","log4net"],"latest_commit_sha":null,"homepage":"https://ptv-logistics.github.io/Log4ALA/","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ptv-logistics.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-10T15:39:44.000Z","updated_at":"2025-04-07T14:24:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"2fb7eaae-41d1-49c6-a48a-e2b8f691a36d","html_url":"https://github.com/ptv-logistics/Log4ALA","commit_stats":null,"previous_names":[],"tags_count":36,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ptv-logistics%2FLog4ALA","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ptv-logistics%2FLog4ALA/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ptv-logistics%2FLog4ALA/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ptv-logistics%2FLog4ALA/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ptv-logistics","download_url":"https://codeload.github.com/ptv-logistics/Log4ALA/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248843950,"owners_count":21170495,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["azure","azure-log-analytics","csharp","log-analytics","log4net"],"created_at":"2024-12-24T09:15:08.915Z","updated_at":"2025-04-14T08:14:53.013Z","avatar_url":"https://github.com/ptv-logistics.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Log4ALA\n\nLog4Net appender fo Azure Log Analytics (ALA)... sending data to Azure Log Analytics.\nThe data will also be logged/sent asynchronously for high performance and to avoid blocking the caller thread.\n\n## Get it\n\nYou can obtain this project as a [Nuget Package](https://www.nuget.org/packages/Log4ALA)\n\n    Install-Package Log4ALA\n\nOr reference it and use it according to the [License](./LICENSE).\n\n\n## Create a Azure Log Analytics Workspace\n\n[Create a workspace](https://docs.microsoft.com/en-us/azure/log-analytics/log-analytics-quick-create-workspace)\n\n## Get the workspace id and shared key (aka primary key)\n\n![workspaceId/SharedKey](https://raw.githubusercontent.com/ptv-logistics/Log4ALA/master/oms.jpg)\n\n\n## Logs Ingestion API support\n\n### General description\n\nhttps://learn.microsoft.com/en-us/azure/azure-monitor/logs/logs-ingestion-api-overview\n\n\n### Configuration settings\n \u003cb\u003eingestionApi\u003c/b\u003e\u003c/br\u003e\n To use the new Ingestion API set to true - default is false.\u003c/br\u003e\n If true workspaceId and SharedKey can leave empty\u003c/br\u003e\n \u003cb\u003elogType\u003c/b\u003e\u003c/br\u003e\n The Custom table name without _CL\u003c/br\u003e![workspaceId/SharedKey](https://raw.githubusercontent.com/ptv-logistics/Log4ALA/master/table.png)\u003c/br\u003e\n \u003cb\u003eingestionApiGzip\u003c/b\u003e\u003c/br\u003e\n To compress the send ingestion logs - default is true\u003c/br\u003e\n \u003cb\u003etenantId\u003c/b\u003e\u003c/br\u003e\n Tenant ID of your Microsoft Entra ID\u003c/br\u003e\n \u003cb\u003eappId\u003c/b\u003e\u003c/br\u003e\n Application ID of your registered Microsoft Entra Application and service principal\u003c/br\u003e\n \u003cb\u003eappSecret\u003c/b\u003e\u003c/br\u003e\n The secret of the above application ID\u003c/br\u003e\n \u003cb\u003edcrEndpoint\u003c/b\u003e\u003c/br\u003e\n The dcr endpoint URI\u003c/br\u003e\n \u003cb\u003edcrId\u003c/b\u003e\u003c/br\u003e\n The data collection rule (dcr) id which should be used for the transformation\u003c/br\u003e\n \u003cb\u003edcrEndpointApiVersion\u003c/b\u003e\u003c/br\u003e\n The dcr endpoint api version - default is 2023-01-01\n\n### Changed Behaviour\n\n **Important** ...if the Logs Ingestion API will be used instead of the deprecated HTTP Data Collector API the custom fields/ columns in the Log Analytics table won't be created automatically any longer\nand need to be created manually in the depending Log Analytics table and also added in the data collection rule (dcr) definition for the transformation.\n\n#### How to change Log Analytics table schema + dcr\n\nCustom table schema changes e.g. add/delete/change columns can be done with [UpdateLogAnalyticsCustomTableAndDcr.ps1](https://github.com/ptv-logistics/Log4ALA/blob/master/Log4ALA/UpdateLogAnalyticsCustomTableAndDcr.ps1)\n\n\n## Use it\n\nThis example is also available as a [LoggerTests.cs](https://github.com/ptv-logistics/Log4ALA/blob/master/Log4ALA/LoggerTests.cs):\n\n```csharp\nusing log4net;\nusing System;\n\nnamespace Log4ALATest\n{\n    class LoggerTests\n    {\n\n        private static ILog alaLogger1 = LogManager.GetLogger(\"Log4ALALogger_1\");\n        private static ILog alaLogger2 = LogManager.GetLogger(\"Log4ALALogger_2\");\n        private static ILog alaLogger3 = LogManager.GetLogger(\"Log4ALALogger_3\");\n\n        static void Main(string[] args)\n        {\n\n            //Log message as anonymous type... the properties will then be mapped to Azure Log Analytic properties/columns.\n            for (int i = 0; i \u003c 10; i++)\n            {\n                alaLogger1.Info(new { id = $\"log-{i}\", message = $\"test-{i}\" });\n            }\n\n            System.Console.WriteLine(\"done1\");\n\n            //Log messages with semicolon separated key=value strings...the keys will then be mapped to Azure Log Analytic properties/columns.\n            for (int i = 0; i \u003c 10; i++)\n            {\n                alaLogger2.Info($\"id=log-{i}; message=test-{i}\");\n            }\n\n            System.Console.WriteLine(\"done2\");\n\n            //Log messages with semicolon separated key=value strings and duplicate key detection... the duplicate keys in the following example \n            //will be mapped to Azur Log Analytic properties/columns message_Duplicate0 and message_Duplicate1.\n            for (int i = 0; i \u003c 10; i++)\n            {\n                alaLogger2.Info($\"id=log-{i}; message=test-{i}; message=test-{i}; message=test-{i}\");\n            }\n\n            System.Console.WriteLine(\"done3\");\n\n            //Log message as json string ...the json properties will then be mapped to Azure Log Analytic properties/columns.\n            for (int i = 0; i \u003c 10; i++)\n            {\n                alaLogger3.Info($\"{{\\\"id\\\":\\\"log-{i}\\\", \\\"message\\\":\\\"test-{i}\\\"}}\");\n            }\n\n            System.Console.WriteLine(\"done4\");\n\n\n\t\t\t//log message if separators are changed from defaults = and ; to [=] and [;]\n\t\t\t//Log4ALAAppender_3.keyValueSeparator=\"[=]\"\n\t\t\t//and\n\t\t\t//Log4ALAAppender_3.keyValuePairSeparator=\"[;]\"\n            for (int i = 0; i \u003c 10; i++)\n            {\n                alaLogger3.Info($\"id[=]log={i}[;]message[=]test={i}\");\n            }\n\n\n            System.Console.WriteLine(\"done5\");\n\n            System.Threading.Thread.Sleep(new TimeSpan(0, 5, 0));\n        }\n    }\n}\n\n``` \n\n## Proxy settings\n\nAt the the moment the default proxy could only be set by config (Web.config or App.config):\n\nRefer to this [article](https://msdn.microsoft.com/en-us/library/kd3cf2ex(v=vs.110).aspx) for more information.\n```xml\n\u003cconfiguration\u003e\n    \u003csystem.net\u003e\n        \u003cdefaultProxy\u003e\n            \u003cproxy\n              proxyaddress=\"http://IP:PORT\"\n              bypassonlocal=\"true\" /\u003e\n        \u003c/defaultProxy\u003e\n    \u003c/system.net\u003e\n\u003cconfiguration\u003e\n``` \n\n\nor by code:\n\n```csharp\n\nSystem.Net.WebRequest.DefaultWebProxy = new System.Net.WebProxy(\"http://IP:PORT/\", true);\n\n``` \n\n## Features\n\n1. You can batch multiple log messages together in a single request by configuration with the properties batchSizeInBytes, batchNumItems or batchWaitInSec (described further down). \nIf batchSizeInBytes will be choosed the collecting of the log data will be stopped and send to Azure Log Analyitcs if batchSizeInBytes will be reached or the duration is \u003e= BatchWaitMaxInSec with default 60s or \nbatch size \u003e= BatchSizeMax 30 mb (1 mb for Ingestion API)  this conditions applies also if you choose batchNumItems. In case of batchWaitInSec collecting will be stopped and send if batchWaitInSec will be reached or the batch size will be \u003e= BatchSizeMax 30 mb (1 mb for Ingestion API) .\n2. Auto detection/convertion of numeric, boolean, and dateTime string values to the [ Azure Log Analytics type _s, _g, _d, _b and _t](https://docs.microsoft.com/en-us/azure/log-analytics/log-analytics-data-collector-api#record-type-and-properties)().\n3. Field values greater than 32 KB (64 KB for Ingestion API) will be truncated (the value could be configured with maxFieldByteLength).\n4. Field names greater than 100 chars (45 chars for Ingestion API) will be truncated (the value could be configured with maxFieldNameLength).\n5. Configurable core field names (the value could be configured with coreFieldNames).\n6. Configurable background worker thread priority (the value could be configured with threadPriority).\n7. Configurable abortTimeoutSeconds - the time to wait for flushing the remaining buffered data to Azure Log Analytics if e.g. the Log4Net process will be shutdown.\n8. Configurable detection of json strings (e.g. \"{\\\"id\\\":\\\"log-1\\\", \\\"message\\\":\\\"test-1\\\"}\") or key value (e.g. \"message=test-1\") in the log messages with the properties jsonDetection (default true) and keyValueDetection (default true). Azure Log Analytics creates \ncustom fields/ record types for each incoming json property or key name. \n **Important** ...if the Logs Ingestion API will be used the custom fields/ columns in the Log Analytics table won't be created automatically any longer\nand need to be created manually in the depending Log Analytics table and also added in the data collection rule (dcr) definition for the transformation.\n9. Configurable keyValue detection with keyValueSeparator and keyValuePairSeparator properties. To configure any other single char or multiple chars as separator for the keyValue detection in the log message.\nTo avoid format conflicts e.g. with the semicolon separated key=value log message \"Err=throws xy exception;Id=123\" normally you will get two custom fields/records in Azure Log Analytics \nErr_s:\"throws xy exception\" and Id_d:123 but if you like to use one of the default keyValueSeparator \"=\" or the default keyValuePairSeparator \";\" chars in the value itself e.g. \"Err=throws exception = exception\nname;Id=123\" you will run into a format conflict normally you expect to get Err_s:\"throws exception = exception name\" but for the Err key in the log message you will get Err_s:\"throws\" and MiscMsg_s:\"exception\nexception name\" and Id_d:123 as custom fields in Azure Log Analytics because of the keyValue separator char \"=\" contained in the value itself. To avoid this behaviour e.g. set the properties keyValueSeparator \nto \"[=]\" and keyValuePairSeparator to \"[;]\" and now your log message should look like \"Err[=]throws exception = exception name[;]Id[=]123\".\n10. Disable the MiscMessageFieldName of the coreFieldNames property (default is MiscMessageFieldName=\"MiscMsg\") as custom field prefix with the property disableAnonymousPropsPrefix (true/false default is false) in case of using anonymous types as log message e.g. with \nalaLogger2.Info(new { Id=$\"log-{i}\", Message=$\"test-{i}\", Num=i, IsEnabled=true }) wich will lead to the following Azure Log Analytics Custom Fields: MiscMsg_Id_s, MiscMsg_Message_s, MiscMsg_Num_d, MiscMsg_IsEnabled_b to \nlog without prefix set disableAnonymousPropsPrefix=true and you will get the custom fields Id_s, Message_s, Num_d, IsEnabled_b without MiscMsg_ prefix.\n11. Configurable workspace domain name default is ods.opinsights.azure.com (the domain name could be configured with logAnalyticsDNS). Now it's possible to change the domain name to Azure government workspaces ods.opinsights.azure.**us**.\n12. Configurable passthrough timestamp with enablePassThroughTimeStampField default is false if true the field should be contained in the log message e.g with \"...;DateValue=2016-05-12T20:00:00.625Z;...\".\n\n\n\n## General Configuration \n\nIt's possible to configure multiple log4net Azure Log Analytics appender(s). The properties (e.g. workspaceId, SharedKey...) of each appender could be configured as \nappender properties, appSettings in App.config/Web.config or as Azure Configuration Setting (Azure settings are excluded from netstandard2.0 and netcoreapp2.0) with fallback strategy AzureSetting=\u003eappSetting=\u003eappenderProperty.\nIf the properties will be configured as appSetting in App.config/Web.config or as Azure Configuration Settings it's important to attach the appender name as prefix \nto the property e.g. **YourAppenderName.workspaceId**\n\n\n## Example App Configuration file\n\nThis configuration is also available as a [App.config](https://github.com/ptv-logistics/Log4ALA/blob/master/Log4ALATest/App.config):\n\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"utf-8\" ?\u003e\n\u003cconfiguration\u003e\n  \u003cstartup\u003e\n    \u003csupportedRuntime version=\"v4.0\" sku=\".NETFramework,Version=v4.5.2\" /\u003e\n  \u003c/startup\u003e\n\n  \u003cappSettings\u003e\n    \u003c!--\n    don't forget to add [assembly: log4net.Config.XmlConfigurator()] to AssemblyInfo.cs\n    --\u003e\n    \u003cadd key=\"log4net.Config\" value=\"log4net.config\"/\u003e\n    \u003cadd key=\"log4net.Config.Watch\" value=\"True\"/\u003e\n\n\t\u003c!--ALAAppender name (prefix) dependent settings--\u003e\n    \u003cadd key=\"Log4ALAAppender_1.workspaceId\" value=\"\"/\u003e\n    \u003cadd key=\"Log4ALAAppender_1.SharedKey\" value=\"\"/\u003e\n\n    \u003c!-- +++++++++++++++++++++++++++++++++++ --\u003e\n    \u003c!-- Properties to use the Ingestion API --\u003e\n    \u003c!-- +++++++++++++++++++++++++++++++++++ --\u003e\n\n    \u003c!-- to use the new Ingestion API set to true - default is false --\u003e\n    \u003c!-- if true the above workspaceId and SharedKey can leave empty --\u003e\n    \u003cadd key=\"Log4ALAAppender_1.ingestionApi\" value=\"false\"/\u003e\n    \u003c!--to compress the send ingestion logs - default is true--\u003e\n    \u003cadd key=\"Log4ALAAppender_1.ingestionApiGzip\" value=\"true\"/\u003e \n    \u003c!-- Tenant ID of your Microsoft Entra ID  --\u003e\n    \u003cadd key=\"Log4ALAAppender_1.tenantId\" value=\"\"/\u003e\n    \u003c!-- Application ID of your registered Microsoft Entra Application and service principal --\u003e\n    \u003cadd key=\"Log4ALAAppender_1.appId\" value=\"\"/\u003e\n    \u003c!-- the secret of the above application ID--\u003e\n    \u003cadd key=\"Log4ALAAppender_1.appSecret\" value=\"\"/\u003e\n    \u003c!-- the dcr endpoint --\u003e\n    \u003cadd key=\"Log4ALAAppender_1.dcrEndpoint\" value=\"\"/\u003e\n    \u003c!-- the data collection rule (dcr) id which should be used for the transformantion --\u003e\n    \u003cadd key=\"Log4ALAAppender_1.dcrId\" value=\"dcr-...\"/\u003e\n    \u003c!-- the dcr endpoint api version - default is 2023-01-01 --\u003e\n    \u003cadd key=\"Log4ALAAppender_1.dcrEndpointApiVersion\" value=\"2023-01-01\"/\u003e\n\n\n    \u003cadd key=\"Log4ALAAppender_1.logType\" value=\"\"/\u003e\n    \u003cadd key=\"Log4ALAAppender_1.logMessageToFile\" value=\"true\"/\u003e\n\n    \n    \u003cadd key=\"Log4ALAAppender_2.workspaceId\" value=\"\"/\u003e\n    \u003cadd key=\"Log4ALAAppender_2.SharedKey\" value=\"\"/\u003e\n    \u003cadd key=\"Log4ALAAppender_2.logType\" value=\"\"/\u003e\n    \u003cadd key=\"Log4ALAAppender_2.logMessageToFile\" value=\"true\"/\u003e\n\n    \u003c!-- optional log message key value separator e.g. \"key=value\" (default =) --\u003e\n    \u003cadd key=\"Log4ALAAppender_3.keyValueSeparator\" value=\"[=]\"/\u003e\n    \u003c!-- optional log message key value pair separator e.g \"key1=value1;key2=value2\"  (default ;) --\u003e\n    \u003cadd key=\"Log4ALAAppender_3.keyValuePairSeparator\" value=\"[;]\"/\u003e\n\n\n    \u003c!--Log4ALA common settings--\u003e\n    \u003cadd key=\"alaQueueSizeLogIntervalEnabled\" value=\"false\"/\u003e\n    \u003cadd key=\"alaQueueSizeLogIntervalInSec\" value=\"100\"/\u003e\n\t\u003c!-- \n    optional setting to avoid info log file if true (log4ALA_info.log or defined with infoAppenderFile) e.g on production system (default false).\n    --\u003e\n    \u003cadd key=\"disableInfoLogFile\" value=\"false\"/\u003e\n    \u003c!-- \n    optional setting to enable verbose/debug logging on console and in the log4ALA_error.log (default false).\n    --\u003e\n    \u003cadd key=\"enableDebugConsoleLog\" value=\"false\"/\u003e\n\n\n  \u003c/appSettings\u003e\n\n\u003c/configuration\u003e\n``` \n\n## Example AppSettings ASP.NET Core\n\nThis configuration is also available as a [appsettings.json](https://github.com/ptv-logistics/Log4ALA/blob/master/Log4ALATest.Core/appsettings.json):\n\n\n```json\n{\n \n  \"Log4ALAAppender_2\": {\n\n    \"workspaceId\": \"\",\n    \"SharedKey\": \"\",\n    \"ingestionApi\": false,\n    \"ingestionApiGzip\": true ,\n    \"tenantId\": \"\",\n    \"appId\": \"\",\n    \"appSecret\": \"\",\n    \"dcrEndpoint\": \"\",\n    \"dcrId\": \"\",\n    \"dcrEndpointApiVersion\": \"\",\n    \"logType\": \"\",\n    \"logMessageToFile\": true,\n    \"jsonDetection\": true,\n    \"batchWaitMaxInSec\": \"2\",\n    \"coreFieldNames\": \"{'DateFieldName':'DateValue','MiscMessageFieldName':'MiscMsg','LoggerFieldName':'Logger','LevelFieldName':'Level'}\",\n\t\"keyValueSeparator\": \"[=]\",\n    \"keyValuePairSeparator\": \"[;]\"\n   },\n   \"alaQueueSizeLogIntervalEnabled\": false,\n   \"alaQueueSizeLogIntervalInSec\": \"100\",\n   \"disableInfoLogFile\": false,\n   \"enableDebugConsoleLog\": false,\n   \n    \"Logging\": {\n      \"IncludeScopes\": false,\n      \"Debug\": {\n        \"LogLevel\": {\n          \"Default\": \"Warning\"\n        }\n      },\n      \"Console\": {\n        \"LogLevel\": {\n          \"Default\": \"Warning\"\n        }\n      }\n    }\n}\n``` \n\nit's also possible to override all Log4ALA appsettings.json configuration settings during runtime by setting the depending environment \nvariable with dotnetcore appsettings notation e.g.:\n\n```csharp\n // path = D:\\home\\LogFiles\\Log4Net if your ASP.NET Core App will be deployid as Azure App Service\n var path = Path.Combine(System.Environment.GetEnvironmentVariable(\"HOME\"), \"LogFiles\", \"Log4Net\");\n System.Environment.SetEnvironmentVariable(\"Log4ALAAppenderAll:errAppenderFile\", Path.Combine(path, \"log4ALA_error.log\"));\n System.Environment.SetEnvironmentVariable(\"Log4ALAAppenderAll:infoAppenderFile\", Path.Combine(path, \"log4ALA_info.log\"));\n``` \n\nor by using appsettings.{env.EnvironmentName}.json (env.EnvironmentName =\u003e ASPNETCORE_ENVIRONMENT environment variable). \nThe order of the appsettings loading strategy how the settings will be overwritten or extended is:\n\nappsettings.shared_lnk.json \u003c-- appsettings.json \u003c-- appsettings.env_{EnvVars[\"ASPNETCORE_ENVIRONMENT\"]}.json \u003c-- appsettings.user_{System.Environment.UserName.ToLower()}.json \n\u003c-- appsettings.env_{EnvVars[\"APPSETTINGS_SUFFIX\"]}.json \u003c-- EnvironmentVariables\n\ninheritance: \"\u003c--\"\n\nPitfall:\n1. don't forget to restart VS if you add or change any environment variable e.g. with \nControl Panel \u003e System \u003e Advanced system settings \u003e Environment Variables... \u003e New System Variable because without a restart the new environment variable couldn't be loaded in debug mode.\n2. don't forget to set the VS project file property \"Copy to Output Directory: Copy if newer or Copy alway\" of newly added appsetings.*.properties (not required for AspNetCore)\n\n\n\n\n## Example Log4Net Configuration file\n\n```xml\n﻿\u003c?xml version=\"1.0\" encoding=\"utf-8\" ?\u003e\n\u003clog4net\u003e\n\n  \u003cappender name=\"Log4ALAAppender_1\" type=\"Log4ALA.Log4ALAAppender, Log4ALA\" \u003e\n    \u003cfilter type=\"log4net.Filter.LevelRangeFilter\"\u003e\n      \u003clevelMin value=\"INFO\" /\u003e\n      \u003clevelMax value=\"FATAL\" /\u003e\n    \u003c/filter\u003e\n  \u003c/appender\u003e\n  \u003cappender name=\"Log4ALAAppender_2\" type=\"Log4ALA.Log4ALAAppender, Log4ALA\" /\u003e\n\n\n  \u003cappender name=\"Log4ALAAppender_3\" type=\"Log4ALA.Log4ALAAppender, Log4ALA\"\u003e\n\n    \u003c!--mandatory id of the Azure Log Analytics WorkspaceID --\u003e\n    \u003cworkspaceId value=\"\" /\u003e\n    \u003c!--mandatory primary key Primary Key OMS Portal Overview/Settings/Connected Sources--\u003e\n    \u003cSharedKey value=\"\" /\u003e\n    \u003c!-- mandatory log type... the name of the record type that you'll be creating--\u003e\n    \u003clogType value=\"\" /\u003e\n    \u003c!-- optional API version of the HTTP Data Collector API (default 2016-04-01) --\u003e\n    \u003c!--\u003cazureApiVersion value=\"2016-04-01\" /\u003e--\u003e\n    \u003c!-- optional max retries if the HTTP Data Collector API request failed (default 6 retries) --\u003e\n    \u003c!--\u003chttpDataCollectorRetry value=\"6\" /\u003e--\u003e\n\n    \u003c!-- +++++++++++++++++++++++++++++++++++ --\u003e\n    \u003c!-- Properties to use the Ingestion API --\u003e\n    \u003c!-- +++++++++++++++++++++++++++++++++++ --\u003e\n\n    \u003c!-- to use the new Ingestion API set to true - default is false --\u003e\n    \u003cingestionApi value=\"false\"/\u003e\n    \u003c!--to compress the send ingestion logs - default is true--\u003e\n    \u003cingestionApiGzip value=\"true\"/\u003e \n    \u003c!-- Tenant ID of your Microsoft Entra ID  --\u003e\n    \u003ctenantId value=\"\"/\u003e\n    \u003c!-- Application ID of your registered Microsoft Entra Application and service principal --\u003e\n    \u003cappId value=\"\"/\u003e\n    \u003c!-- the secret of the above application ID--\u003e\n    \u003cappSecret value=\"\"/\u003e\n    \u003c!-- the dcr endpoint --\u003e\n    \u003cdcrEndpoint value=\"\"/\u003e\n    \u003c!-- the data collection rule (dcr) id which should be used for the transformantion --\u003e\n    \u003cdcrId value=\"dcr-...\"/\u003e\n    \u003c!-- the dcr endpoint api version - default is 2023-01-01 --\u003e\n    \u003cdcrEndpointApiVersion value=\"2023-01-01\"/\u003e\n\n\n\t \n    \u003c!-- \n    optional debug setting which should only be used during development or on testsystem. Set \n\tlogMessageToFile=true to inspect your messages (in log4ALA_info.log) which will be sent to the \n\tAzure Log Analytics Workspace (default false).\n    --\u003e\n    \u003c!--\u003clogMessageToFile value=\"true\"/\u003e--\u003e\n\n    \u003c!-- \n    optional name of an logger defined further down with an depending appender e.g. logentries to log internal \n\terrors. If the value is empty or the property isn't defined errors will only be logged to log4ALA_error.log\n    --\u003e\n    \u003c!--\u003cerrLoggerName value=\"Log4ALAErrors2LogentriesLogger\"/\u003e--\u003e\n\n    \u003c!-- optional appendLogger to enable/disable sending the logger info \n         to Azure Log Analytics (default true)\n    \u003cappendLogger value=\"true\"/\u003e\n\t  --\u003e\n\n    \u003c!-- optional appendLogLevel to enable/disable sending the log level\n         to Azure Log Analytics (default true)\n    \u003cappendLogLevel value=\"true\"/\u003e\n\t  --\u003e\n\n    \u003c!-- optional error log file configuration (default relative_assembly_path/log4ALA_error.log)\n    \u003cerrAppenderFile value=\"C:\\ups\\errApp.log\"/\u003e\n\t  --\u003e\n\n    \u003c!-- optional info log file configuration (default relative_assembly_path/log4ALA_info.log)\n    \u003cinfoAppenderFile value=\"C:\\ups\\infoApp.log\"/\u003e\n\t  --\u003e\n\n    \u003c!-- optional batch configuration to send a defined byte size of log messages as batch to Azure Log Analytics \n\t(default 0)\n\n    \u003cbatchSizeInBytes value=\"0\"/\u003e\n\t  --\u003e\n     \u003c!-- optional batch configuration to send a defined number of log items as batch to Azure Log Analytics \n\t     (default 1)\n\n     \u003cbatchNumItems value=\"1\"/\u003e\n\t  --\u003e\n     \u003c!-- optional batch configuration to send a time based collection of log messages as batch to Azure Log Analytics \n\t     (default 0)\n\n     \u003cbatchWaitInSec value=\"0\"/\u003e\n\t  --\u003e\n     \u003c!-- optional interval after a batch process will be finished to send the collected of log messages as batch to \n\t     Azure Log Analytics (default 60)\n\n     \u003cbatchWaitMaxInSec value=\"60\"/\u003e\n\t  --\u003e\n     \u003c!-- optional trim field values to the max allowed size of 32 KB (default 32 KB)\n     \u003cmaxFieldByteLength value=\"32000\"/\u003e\n\t  --\u003e\n     \u003c!-- optional to change the core Azure Log Analytics field names \n\t     (default {'DateFieldName':'DateValue','MiscMessageFieldName':'MiscMsg','LoggerFieldName':'Logger','LevelFieldName':'Level'})\n    \n\t \u003ccoreFieldNames value=\"{'DateFieldName':'DateValue','MiscMessageFieldName':'MiscMsg','LoggerFieldName':'Logger','LevelFieldName':'Level'}\"/\u003e\n\t  --\u003e\n     \n\t \u003c!-- optional trim field values to the max allowed field name length of 100  (default 100)\n     \u003cmaxFieldNameLength value=\"100\"/\u003e\n\t  --\u003e\n\n     \u003c!-- optional priority of the background worker thread which collects and send the log messages to Azure Log Analytics\n          possible values Lowest/BelowNormal/Normal/AboveNormal/Highest  (default Lowest)\n     \u003cthreadPriority value=\"Lowest\"/\u003e\n\t  --\u003e\n\n     \u003c!-- optional the time to wait for flushing the remaining buffered data to Azure Log Analytics if e.g. the Log4Net\n\t      process will be shutdown  (default 10 seconds)\n     \u003cabortTimeoutSeconds value=\"10\"/\u003e\n\t  --\u003e\n\n     \u003c!-- optional log message key value separator e.g. \"key=value\" (default =)\n     \u003ckeyValueSeparator value=\"[=]\"/\u003e\n\t  --\u003e\n\n     \u003c!-- optional log message key value pair separator e.g \"key1=value1;key2=value2\"  (default ;)\n     \u003ckeyValuePairSeparator value=\"[;]\"/\u003e\n\t  --\u003e\n\n\t \u003c!-- optional property disableAnonymousPropsPrefix (true/false default is false) to disable the MiscMessageFieldName \n\t      (default is MiscMsg) as prefix in case of logging with anonymous types\n     \u003cdisableAnonymousPropsPrefix value=\"false\"/\u003e\n\t  --\u003e\n\n\t \u003c!-- optional property disableAnonymousPropsPrefix (default is ods.opinsights.azure.com) to change the workspace domain name\n     \u003clogAnalyticsDNS value=\"ods.opinsights.azure.com\"/\u003e\n\t  --\u003e\n\n\t \u003c!-- optional property enablePassThroughTimeStampField (default is false) to passthrough the timestamp field (which will be used as Log Analytics TimeGenerated field)\n\t      if true the field should be contained in the log message e.g with \"...;DateValue=2016-05-12T20:00:00.625Z;...\".\n     \u003cenablePassThroughTimeStampField value=\"false\"/\u003e\n\t  --\u003e\n  \n\n  \u003c/appender\u003e\n  \n  \u003c!--\n  \u003cappender name=\"LeAppender\" type=\"log4net.Appender.LogentriesAppender, LogentriesLog4net\"\u003e\n    \u003cimmediateFlush value=\"true\" /\u003e\n    \u003cuseSsl value=\"true\" /\u003e\n    \u003ctoken value=\"YOUR_LOGENTRIES_TOKEN\" /\u003e\n    \u003clayout type=\"log4net.Layout.PatternLayout\"\u003e\n      \u003cparam name=\"ConversionPattern\" value=\"%d{yyyy-MM-dd HH:mm:ss.fff zzz};loglevel=%level%;operation=%m;\" /\u003e\n    \u003c/layout\u003e\n    \u003cfilter type=\"log4net.Filter.LevelRangeFilter\"\u003e\n      \u003clevelMin value=\"INFO\" /\u003e\n      \u003clevelMax value=\"FATAL\" /\u003e\n    \u003c/filter\u003e\n  \u003c/appender\u003e\n\n  \u003clogger name=\"Log4ALAErrors2LogentriesLogger\" additivity=\"false\"\u003e\n    \u003clevel value=\"ALL\" /\u003e\n    \u003cappender-ref ref=\"LeAppender\" /\u003e\n  \u003c/logger\u003e\n  --\u003e\n \n  \u003c!--\u003clogger name=\"Log4ALALoggerAllInOne\" additivity=\"false\"\u003e\n    \u003cappender-ref ref=\"Log4ALAAppender_1\" /\u003e\n    \u003cappender-ref ref=\"Log4ALAAppender_2\" /\u003e\n    \u003cappender-ref ref=\"Log4ALAAppender_3\" /\u003e\n  \u003c/logger\u003e--\u003e\n\n  \u003clogger name=\"Log4ALALogger_1\" additivity=\"false\"\u003e\n    \u003cappender-ref ref=\"Log4ALAAppender_1\" /\u003e\n  \u003c/logger\u003e\n  \n  \u003clogger name=\"Log4ALALogger_2\" additivity=\"false\"\u003e\n    \u003cappender-ref ref=\"Log4ALAAppender_2\" /\u003e\n  \u003c/logger\u003e\n\n  \u003clogger name=\"Log4ALALogger_3\" additivity=\"false\"\u003e\n    \u003cappender-ref ref=\"Log4ALAAppender_3\" /\u003e\n  \u003c/logger\u003e\n\n\u003c/log4net\u003e\n``` \n\n## Issues\n\n[Data ingestion time in Log Analytics](https://docs.microsoft.com/en-us/azure/log-analytics/log-analytics-data-ingestion-time)\nKeep in mind that this library won't assure that your JSON payloads are being indexed, it will make sure that the Logs Ingestion API and the HTTP Data Collection API [responds an Accept](https://azure.microsoft.com/en-us/documentation/articles/log-analytics-data-collector-api/#return-codes) typically it takes just a few seconds for the data/payload to be indexed, to know how much time does it take until the posted data has been indexed completely go to the \nAzure Portal and select the depending Log Analytics Workspace/Usage and estimated costs and then click *Insights* then tab *Usage* scroll over to the bottom and the tab *Ingestion Latency* ... There can be Live Site issues causing some delays, hence the official SLA is longer than this see also [SLA for Log Analytics](https://azure.microsoft.com/en-gb/support/legal/sla/log-analytics/v1_1/).\n\n## Supported Frameworks\n\n* .NETFramework \u003e= 4.5\n* .NETStandard \u003e= 2.0","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fptv-logistics%2Flog4ala","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fptv-logistics%2Flog4ala","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fptv-logistics%2Flog4ala/lists"}