Sean Kearon
Sean Kearon

Reputation: 11427

Log from Rebus to Application Insights

When running a Rebus service bus, how would you set Rebus up to log to Application Insights?

Upvotes: 1

Views: 439

Answers (1)

mookid8000
mookid8000

Reputation: 18628

One way would be to configure Rebus to use Serilog, and then use the Application Insights sink to pipe logs as trace or event telemetry.

Something like this:

// global Serilog config
Log.Logger = new LoggerConfiguration()
    .WriteTo.ColoredConsole()
    .WriteTo.ApplicationInsights(...) //< fill in instrumentation key etc here
    .CreateLogger();

// configure Rebus
Configure.With(activator)
    .Logging(l => l.Serilog())
    .Transport(t => t.UseInMemoryTransport(new InMemNetwork(), "logging-test"))
    .Start();

Upvotes: 1

Related Questions