0

I am working on an Web Api in .net. I am writing logs using Serilog and Seq. I made the configuration following the Seq official web site. Basically placing this code in my startup.cs file:

var logger = new LoggerConfiguration()
                .MinimumLevel.Debug()
                .WriteTo.Seq("http://localhost:5431/")
                .CreateLogger();
builder.RegisterInstance<Serilog.ILogger>(logger);

I am logging to localhost so I am able to see my logs locally. So far so good.

I deployed my Api to azure and I want to continue logging on the same way. So I worked with the link https://docs.getseq.net/v3/docs/azure-installation and made the configuration. I had to create a virtual machine different from my ServicePlan and my Api. I installed Seq on that VM and run the Seq program on the url http://example.azurewebsites.net:5341/ so I made the change in my startup file too.

.WriteTo.Seq("http://example.azurewebsites.net:5341/")

I also had to create a Firewall Rule in the port 5341 in my VM and an Inbound Rule in the VM Network Security Rule.

I deployed again, at this point I would expect yo have Seq running on http://example.azurewebsites.net:5341/, but that is not certainly happening because I cannot find anything at the url neither from my PC browser nor from VM browser.

What am I missing? or In which configuration steps I have to check again?

Nicholas Blumhardt
  • 30,271
  • 4
  • 90
  • 101
afonte
  • 938
  • 9
  • 17

1 Answers1

0

In my experience so far, VMs live at *.cloudapp.net subdomains, not *.azurewebsites.net (which is IIRC the Azure App Service).

Nicholas Blumhardt
  • 30,271
  • 4
  • 90
  • 101
  • Following your answer I changed to *.cloudapp.net but nothing happens. Should I do something else in my portal azure? – afonte Mar 27 '17 at 00:23
  • Did you also specify the `*.azurewebsites.net` domain when configuring Seq? You can verify by running `seq config -k api.listenUris` from an admin command-prompt on the Seq server. If so, run the command again passing `-v (the new URL)` and then `seq restart`. Cheers! – Nicholas Blumhardt Mar 27 '17 at 09:19
  • I ran the `config -k` command and it printed `http://*.cloudapp.net:5341` as expected. I ran the second one changing the url to `*.azurewebsites.net:5341` and then `seq restart`. I checked the listenUris again and the change was done properly. But if I type that url in the VM browser I am unable to see Seq running. – afonte Mar 28 '17 at 03:00
  • If I do my config at `localhost:5341` I can see Seq running, but I won't be able to write logs from my API running on a different machine in azure, right? – afonte Mar 28 '17 at 03:05
  • @afonte no, `localhost:5341` is treated as `+:5341` by Seq, so you can use that to listen on any hostname. – Nicholas Blumhardt Mar 28 '17 at 09:39
  • I am not sure to understand your last message, are you suggesting a solution for me? – afonte Mar 28 '17 at 17:23
  • @afonte I'm referring to your previous message: _"If I do my config... right?"_ – Nicholas Blumhardt Mar 28 '17 at 20:49