- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我正在使用 Bunyan 和 bunyas-lumberjack 将我的日志发送到日志存储并在 Elasticsearch 中为它们编制索引。我面临的问题是当我过滤日志时:我正在使用 Logstash 的基本过滤器:
filter {
if [type == "json"]{
json {
source => "message"
}
}
}
将来自 bunyan 的 JSON 放入 source.message 字段并在 Elasticsearch 中对其进行索引。我如何将 bunyan 中的每个字段索引到特定的 Elasticsearch 字段中,以便我可以搜索它或在 Kibana 中使用它?
我附上我现在获得的和我想获得的作为例子。目前:
{
"_index": "logstash-2015.10.26",
"_type": "json",
"_id": "AVCjvDHWHiX5VLMgQZIC",
"_score": null,
"_source": {
"message": "{\"name\":\"myLog\",\"hostname\":\"atnm-4.local\",\"pid\":6210,\"level\":\"error\",\"message\":\"This should work!\",\"@timestamp\":\"2015-10-26T10:40:29.503Z\",\"tags\":[\"bunyan\"],\"source\":\"atnm-4.local/node\"}",
"@version": "1",
"@timestamp": "2015-10-26T10:40:31.184Z",
"type": "json",
"host": "atnm-4.local",
"bunyanLevel": "50"
},
通缉:
{
"_index": "logstash-2015.10.26",
"_type": "json",
"_id": "AVCjvDHWHiX5VLMgQZIC",
"_score": null,
"_source": {
"message": {
"name": example,
"hostname": example,
"etc": example
最佳答案
logstash 中的每个输入都可以有不同的编解码器和类型。在你的例子中,如果你想索引 bunyan 和 syslog,你将有两个具有两种不同类型的输入。 syslog 的编解码器是“plain”,bunyan 的编解码器是“json”。 bunyan 消息不需要任何过滤器。 json 将被解析并且字段将自动出现。您将必须有一个过滤器来解析系统日志输入。
关于node.js - NodeJS Bunyan Logstash 日志索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33343884/
我已经创建了一个 bunyan 的记录器实例 export const createLogger = ( appname: string, ) => bunyan.createLogger({
我试图在我的nodejs应用程序中使用bunyan,但是我坚持这种奇怪的行为。像这样定义记录器: var info = bunyan.createLogger({ name: 'Test',
child.log.info('info'); child.log.debug('debug'); 我使用以下命令: node app.js | bunyan -o short -l debug 但是
我知道这是一个非常抽象的问题,但我只是不知道从哪里/如何开始。 我正在使用bunyan作为我的应用程序中的日志库。这是用于记录某些内容的示例语法: const log = bunyan.create
我正在使用 Bunyan 和 Restify 创建一个 access.log,它将存储有关请求的信息,例如端点、状态代码等...但是,我想将错误与此文件分开并存储它们在单独的日志文件中。 我尝试通过向
有什么方法可以监视 bunyan 日志以确保打印出我期望的内容? MyFile.js const bunyan = require('bunyan'); const log = bunyan.crea
我正在尝试在基于 webpack 的应用程序中设置 Bunyan。 我有以下 webpack 配置: // these shims are needed for bunyan al
这个问题已经有答案了: Logging in nodejs using bunyan logger (3 个回答) 已关闭 8 年前。 我的 NodeJS 应用程序有问题,我想正确记录使用它时发生的所
我已将 Bunyan 日志记录添加到我的应用程序的各个子系统中。但是当我查看日志文件时,我发现日志不是按时间戳排序的。我认为这是预期的,因为 Nodejs 的异步特性。 我想知道是否有任何方法可以更改
有一个 Bunyan 日志,这是一个示例条目 [2016-05-31T15:38:47.889Z] FATAL: jklajsd-utilities/23399 on aaa.bbb.ccc.com:
我正在试验 Node bunyan 模块。作为其中的一部分,我想知道一些关于 Bunyan 的事实.. bunyan 是否提供了一种方法来更改 bunyan 日志上打印的内容的顺序。例如,默认情况下时
我正在使用 bunyan.js 作为我的日志记录解决方案,我想为其日志记录功能添加功能。 例如,我想在每次调用 log.fatal() 时向第三方 API 发送一些内容 这可能吗?我查看了文档,但没有
我用 node.js 和 express 构建了一个应用程序。我已经开始使用 bunyan,但我很难理解热记录请求。 假设我的路由器调用这样的函数: function(request, someOth
使用 Bunyan 时,我所有的日志级别都使用相同的青色,如下所示: 这是我们使用的 Bunyan 配置: const bunyan = require('bunyan'); module.expor
我一直在寻找用于登录我的 nodejs 应用程序的 bunyan。我试过了,一切似乎都运行良好。我跳过了a section在 log.child 上,但现在我正试图了解如何使用它。我认为它的目的是允许
这些是默认字段 { "name": "myapp", "hostname": "banana.local", "pid": 40161, "level": 30, "msg": "
我使用的是bunyan,这是我在日志中写入的示例。 有没有办法改变打印字段的顺序?从此: {"name":"appName","hostname":"ip","pid":5817,"level":30
默认情况下,Sentry 集成了 console.log 以使其成为面包屑的一部分: 链接:Import name: Sentry.Integrations.Console 我们如何让它为 bunya
我正在使用 Bunyan 和 bunyas-lumberjack 将我的日志发送到日志存储并在 Elasticsearch 中为它们编制索引。我面临的问题是当我过滤日志时:我正在使用 Logstash
我通读了 Joyent 的事后调试文章和 they recommended我们使用 bunyan。 他们谈到日志信息的质量非常重要,并且可以在出现错误时帮助解决错误。然后有外部博客网站展示了如何在他们
我是一名优秀的程序员,十分优秀!