Application Data not getting passed to Elastic Search

(Neha Srivastava) #1

We have recently moved to logging using ELK. We are facing issue in sending data from application to elastic search.
Our application is a .Net web application and we are sending data in json format.

We can see the log on Kibana with http details but none of the data from application is visible there.
I believe issue is with the configuration of custom field.

target name="elk" xsi:type="BufferingWrapper" flushTimeout="5000">
target xsi:type="ElasticSearch" uri="" includeAllProperties="true">
field name="MachineName" layout="{MachineName:raw=true}" layoutType="System.String" /> <field name="ApplicationName" layout="{event-properties:item=ApplicationName}" layoutType="System.String" />



logger name="*" minLevel="Info" writeTo="elk" enabled="true" />

Logging is done using following method:

				// Prepare the log event to prepare for logging.
				var theEvent
					= new LogEventInfo
							activityInfo.LogMessage // The message to log.

			//In case there is a global execution context ID, set to the property.
			if (!string.IsNullOrWhiteSpace (executionContextId))
				activityInfo.RequestId = executionContextId;

            var applicationName = this.swissReConfigurationSection.General.ApplicationName;

                applicationName = $"{this.swissReConfigurationSection.General.ApplicationName} - {this.swissReConfigurationSection.General.EnvironmentType}";
            // Add the properties of the event, which will appear as fields in the log.
            // theEvent.Properties.Add(APPLICATION_NAME,applicationName);
            theEvent.Properties[APPLICATION_NAME] = applicationName;
            theEvent.Properties[ACTIVITY_NAME] = activityInfo.ActivityName;
            theEvent.Properties[DURATION_IN_SEC] = activityInfo.DurationInSec;
            theEvent.Properties[STARTED_AT] = activityInfo.StartedAt.ToLongTimeString();
            theEvent.Properties[ENDED_AT] = activityInfo.EndedAt.ToLongTimeString();
            theEvent.Properties[REQUEST_ID] = activityInfo.RequestId;
            theEvent.Properties[USER_ID] = activityInfo.UserId;
                = String.IsNullOrEmpty(activityInfo.RequestText)
                    ? String.Empty
                    : this.ReplaceCrLfWithLineFeed
                = String.IsNullOrEmpty(activityInfo.ResponseText)
                    ? String.Empty : this.ReplaceCrLfWithLineFeed(activityInfo.ResponseText);


(Russ Cam) #2

Please format your code, logs or configuration files using </> icon as explained in this guide and not the citation button. It will make your post more readable.

Or use markdown style like:


This is the icon to use if you are not using markdown format:

There's a live preview panel for exactly this reasons.

Lots of people read these forums, and many of them will simply skip over a post that is difficult to read, because it's just too large an investment of their time to try and follow a wall of badly formatted text.
If your goal is to get an answer to your questions, it's in your interest to make it as easy to read and understand as possible.
Please update your post.

(system) closed #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.