NLog.Mongo icon indicating copy to clipboard operation
NLog.Mongo copied to clipboard

Added support for suffix on database and/or collection

Open nanny07 opened this issue 7 months ago • 0 comments

Summary

This PR introduces the ability to add dynamic suffixes to MongoDB database name and/or collection names in the NLog.Mongo target, enabling more flexible log organization and partitioning strategies (ex. multi tenants)

Changes Made

  • Added databaseSuffixProperty and collectionSuffixProperty to MongoTarget to identify which bson property needs to be read to get the suffix.
  • Updated the collection and database's resolution based on the properties above
  • Updated tests to validate suffix functionality and to show how to configure the property

Fully backward compatible

nanny07 avatar Jun 26 '25 08:06 nanny07