Azure / Azure/diagnostics-eventflow

log4net input should include global and logical thread context data

Open
#287 10 comments 0 reactions 0 assignees View on GitHub
new-feature
Dominant language
C#
Stars
311
Forks
101
PR merge metrics
No merged PRs in 30d

Description

I have a simple eventflow setup writing to elasticsearch with log4net input

class Program
{
static void Main(string[] args)
{
using (var pipeline = DiagnosticPipelineFactory.CreatePipeline(".\\eventFlowConfig.json"))
{
var logger = LogManager.GetLogger("EventFlowRepo", "MY_LOGGER_NAME");
using (LogicalThreadContext.Stacks["NDC"].Push("12345"))
{
logger.Debug("Hey! Listen!", new Exception("uhoh"));
}
}
Console.ReadLine();
}
}
eventflowconfig.json

{
"inputs": [
{
"type": "Log4net",
"logLevel": "Debug"
},
{
"type": "Log4net",
"logLevel": "Info"
},
{
"type": "Log4net",
"logLevel": "Warn"
},
{
"type": "Log4net",
"logLevel": "Error"
},
{
"type": "Log4net",
"logLevel": "Fatal"
}
],
"outputs": [
{
"type": "ElasticSearch",
"indexNamePrefix": "defaultindex",
"serviceUri": "http://servername:9200",
"basicAuthenticationUserName": "user",
"basicAuthenticationUserPassword": "password",
"eventDocumentTypeName": "diagData",
"numberOfShards": 1,
"numberOfReplicas": 0,
"refreshInterval": "5s"
}
],
"settings": {
"pipelineBufferSize": "1000",
"maxEventBatchSize": "100",
"maxBatchDelayMsec": "500",
"maxConcurrency": "8",
"pipelineCompletionTimeoutMsec": "30000"
},
"extensions": []
}

The issue is, the custom data [12345 in this case] I write to the NDC context, is not written to elasticsearch. How do I configure elastic output to recognize any custom data pushed to NDC?
The debug message along with the "exception" message does get written to ELK

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.