I have an application that will write logs to elasticsearch using serilog and is running APM on the docker-compose file. For some reason whenever I run the application and perform a task that will cause an error, it will not record on APM Error's tab, but it will record as an error on the Discover Error Logs which shows up as Level:Error.
On APM it does not show...
Is there a way I can convert that Level:Error log that is shown in the discover to an APM Error type of log so I can view it on the APM Error tab?
My controller that will handle the error (recording it to elasticsearch):
namespace CustomerSimulatorApp.Controllers
{
public class SecondController : Controller
{
private readonly ILogger<SecondController> _logger;
public SecondController(ILogger<SecondController> logger)
{
_logger = logger;
}
public IActionResult SecIndex()
{
return View();
}
[HttpPost]
public IActionResult SecIndex(TextInput form)
{
try
{
/* if (ModelState.IsValid)
return RedirectToAction("FinalIndex", "Final");
else*/
throw new Exception("Looks like you did not type something!");
}
catch(Exception ex)
{
_logger.LogError(ex, "Empty textfield!");
return RedirectToAction("FinalIndex", "Final");
}
}
}
}