Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing certain fields from LogEvent #58

Open
tessierp opened this issue Mar 24, 2023 · 0 comments
Open

Removing certain fields from LogEvent #58

tessierp opened this issue Mar 24, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@tessierp
Copy link

tessierp commented Mar 24, 2023

I would like to know if there is a way to filter out certain fields from what is written in LogEvent. My current configuration is as follow


  {
	"Name": "PostgreSQL",
	"Args": {
	  "connectionString": "DevPostgreSQL",
	  "tableName": "Logs",
	  "schemaName": "log",
	  "needAutoCreateTable": true,
	  "needAutoCreateSchema": true,
	  "loggerColumnOptions": {
		"Id": "IdAutoIncrement",
		"Level": "LevelAsText",
		"TimeStamp": "Timestamp",
		"LogEvent": "LogEvent",
		"MessageTemplate": "Message"
	  },
	  "loggerPropertyColumnOptions": {
		"Application": {
		  "Name": "Application",
		  "Format": "{0}",
		  "WriteMethod": "Raw",
		  "DbType": "Text"
		},
		"LogType": {
		  "Name": "LogType",
		  "Format": "{0}",
		  "WriteMethod": "Raw",
		  "DbType": "Text"
		}
	  }
	}
  }

Which produces the current output in LogEvent :

{
  "Level": "Error",
  "Timestamp": "2023-03-24T12:25:31.3008171-04:00",
  "Properties": {
    "LogType": "Log",
    "Application": "WeatherApp",
    "ExceptionLog": {
      "StackTrace": "   at WebApplication1.Controllers.WeatherForecastController.Exception() in F:\\Users\\someone\\Projects\\Technology\\Coding\\DotNet\\MyProjects\\WebApplication1\\WebApplication1\\Controllers\\WeatherForecastController.cs:line 50",
      "ExceptionMessage": "Logging SystemException for testing purposes.",
      "InnerExceptionMessage": ""
    }
  },
  "MessageTemplate": "{@ExceptionLog}"
}

What I would like is to filter out everything except the content of the Message to produce something like this :

{
    "Properties": {
        "ExceptionLog": {
            "ExceptionMessage": "Logging SystemException for testing purposes.",
            "InnerExceptionMessage": "",
            "StackTrace": "   at WebApplication1.Controllers.WeatherForecastController.Exception() in F:\\Users\\someone\\Projects\\Technology\\Coding\\DotNet\\MyProjects\\WebApplication1\\WebApplication1\\Controllers\\WeatherForecastController.cs:line 50"
        }
    }
}

I was experimenting with the MSSQL Sink which is able to achieve this by configuring these parameters :

"logEvent": {
  "excludeAdditionalProperties": false,
  "excludeStandardColumns": false
},

Is there a way to achieve the same result with PostgreSQL Alternative's Sink? The reason is, all the data can be found in other columns and it would allow me to reduce the size of the data which could add up over time.

Thanks

@SeppPenner SeppPenner self-assigned this Apr 7, 2023
@SeppPenner SeppPenner added the enhancement New feature or request label Apr 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants