I have a Web Api project developed with ASP.NET Core 3.1 and have installed Seq for logging. On my development machine, I receive the logs on Seq UI. I also installed Seq, docker and nginx on my linux server (CentOS 7). Once deployed to a linux server (CentOS 7) with nginx in docker container, the Api runs Ok and the logs are seen on Console, but nothing logs to the Seq UI.
I've tried every known configuration but can't get it to work. I went as far as installing VS Code on the linux server and ran a sample code on it which sucessfully posted logs on the Seq UI so I don't know why my deployed api in docker container never sucessfully logs on the Seq UI. The codes are below:
Startup.cs
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers();
services.AddLogging(loggingBuilder =>
{
loggingBuilder.AddSeq();
});
}
HomeController.cs
private readonly ILogger<HomeController> _logger;
public HomeController(ILogger<HomeController> logger)
{
_logger = logger;
}
public IActionResult Index()
{
_logger.LogInformation("Called Index action in Home Controller.");
return View();
}
These are part of the details when I ran the docker inspect command
...
"Name": "/seq",
"RestartCount": 0,
"Driver": "overlay2",
"Platform": "linux",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "",
"ExecIDs": null,
"HostConfig": {
"Binds": [
"/****/****/Documents/****/****/****/seq:/data:rw"
],
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"NetworkMode": "dryvadevices_default",
"PortBindings": {
"5341/tcp": [
{
"HostIp": "",
"HostPort": "5341"
}
],
"80/tcp": [
{
"HostIp": "",
"HostPort": "9000"
}
]
},
"RestartPolicy": {
"Name": "unless-stopped",
"MaximumRetryCount": 0
},
...
I'm confused and been trying to get it working for some days now. I don't know how to check if maybe nginx is block the post to port 5341 which I doubt. Please I need help as I'm getting realy frustrated. Thanks.