I'm logging user actions in ElasticSearch and I'm using C# Log4Net
I'm using the C# NEST library to access the ElasticSearch database.
My log line looks like this:
{
"_index" : "log-2016.07.27",
"_type" : "logEvent",
"_id" : "AVYrwmW5Hc5CAgECpn_X",
"_score" : 1.0,
"_source" : {
"timeStamp" : "2016-07-27T09:49:35.3774113Z",
"message" : "Upload file operation took 11683 ms",
"loggerName" : "Reviewer.Web.WebApi.GroupsController",
"identity" : "",
"level" : "INFO",
"properties" : {
"log4net:UserName" : "CORP\\g",
"log4net:ElapsedTime" : "11683",
"log4net:Identity" : "",
"IP" : "::1",
"log4net:HostName" : "GBWOTIOM68052D",
"@timestamp" : "2016-07-27T09:49:35.3774113Z"
}
}
I'd like to have the log4net:ElapsedTime
value stored as an integer instead of a string.
currently I'm doing this when storing an elapsed time:
long ms = 1000;
LogicalThreadContext.Properties["log4net:ElapsedTime"] = ms;
I know I should specify a template in order to tell ElasticSearch to store the elapsed value as an integer but how to do it?