How to define custom Fields with NLog Elasticsearch Target

Viewed 2847

I'm using this Elasticsearch Nlog Target to send my logs to Elasticsearch. I want to take advantage of Elasticsearch's ability to define specific Fields in an index. The Elasticsearch Nlog Target's docs show examples of field definitions here.

I want to do this through code and I want to dynamically set the value of the fields with each message I log.

Looking at things from the Elasticsearch side, I want to see something like this, where I've defined and set the values of two custom Fields, prop1 and prop2:

Event schema

1 Answers
Related