Akhil
Akhil

Reputation: 2030

Purging Logs in SQL Database - Serilog

I am using serlog for logging in my webapi and working fine. I used SQL Server to log and the following is the serlog config for the same.

        __serilogLogger = new LoggerConfiguration()
            .Enrich.WithProperty("ApplicationIPv4", _ipv4)
             .Enrich.WithProperty("ApplicationIPv6", _ipv6)
              .WriteTo.MSSqlServer(connectionString, tableName /*, columnOptions: columnOptions*/)
            .WriteTo
            .Seq(ConfigurationManager.AppSettings["SerilogServer"])
            .CreateLogger();

I am beginner in serilog. My confusion is how to purge the logs in database. Any options in serilog to hold last 3 months data only like that.

Upvotes: 2

Views: 972

Answers (1)

Akhil
Akhil

Reputation: 2030

Based on chat in serilog Gitter, there is no option for that. We can do using Sql Job Agent or any other scheduled job.

Upvotes: 3

Related Questions