我正在尝试将角度日志(异常、错误)发送到弹性搜索。所以基本上我们计划创建一个中间日志 API,将数据推送到弹性搜索。我有用 .net 编写的 API,它可以与弹性搜索通信。但我的问题是如何在日志中分配属性,同时将它们从 angular 转发到 api。我没有看到太多这样的例子。我的问题是,这种方法是否正确(角度日志 -> 中间 api -> 弹性搜索)? 如果是这样,当我将日志从 angular 发送到中间 api 时,您能否建议我如何添加索引或时间戳?
这里是直接从api生成的日志部分
{
"_index": "logging-api",
"_type": "_doc",
"_id": "qILeJHcB_U03uXCAT1zW",
"_version": 1,
"_score": null,
"_source": {
"@timestamp": "2021-01-21T12:14:45.0102735+00:00",
"level": "Information",
"messageTemplate": "Executed action {ActionName} in {ElapsedMilliseconds}ms",
"message": "Executed action \"Logging.API.Controllers.LoggingController.Get (Logging.API)\" in 0.6977ms",
"fields": {
"ActionName": "Logging.API.Controllers.LoggingController.Get (Logging.API)",
"ElapsedMilliseconds": 0.6977,
"EventId": {
"Id": 2,
"Name": "ActionExecuted"
},