logstash 安装插件multiline

在使用elk 传输记录 java 日志时,如下

一个java的报错

在elk中会按每一行 产生多条记录,不方便查阅

这里修改配置文件 使用  multiline   插件 即可实现多行合一的 输出模式

修改配置文件

# vi  /etc/logstash/conf.d/logstash.conf  

input {
 file {
    path => "/w_logs/error.log.2018-06-05"
    type => "test"
 }
}

filter {
   multiline {
            pattern => "^\d{4}-\d{1,2}-\d{1,2}\s\d{1,2}:\d{1,2}:\d{1,2}"
            negate => true
            what => "previous"
        }

   grok {
       match => [ "message", "%{NOTSPACE:day} %{NOTSPACE:datetime}  %{NOTSPACE:level} %{GREEDYDATA:msginfo} " ]
   }
}

output {
 if [type] == "test" {
        elasticsearch {
            hosts => ["10.10.15.95:9200"]
            index => "12.83-test"
        }
  }
}

修改完 重启logstash
报错:

[ERROR] 2018-07-13 15:37:59.834 [Ruby-0-Thread-1: /usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/stud-0.0.23/lib/stud/task.rb:22] registry - Tried to load a plugin‘s code, but failed. {:exception=>#<LoadError: no such file to load -- logstash/filters/multiline>, :path=>"logstash/filters/multiline", :type=>"filter", :name=>"multiline"}
[ERROR] 2018-07-13 15:37:59.838 [Ruby-0-Thread-1: /usr/share/logstash/vendor/bundle/jruby/2.3.0/gems/stud-0.0.23/lib/stud/task.rb:22] agent - Failed to execute action {:action=>LogStash::PipelineAction::Create/pipeline_id:main, :exception=>"LogStash::PluginLoadingError", :message=>"Couldn‘t find any filter plugin named ‘multiline‘. Are you sure this is correct? Trying to load the multiline filter plugin resulted in this error: no such file to load -- logstash/filters/multiline", :backtrace=>["/usr/share/logstash/logstash-core/lib/logstash/plugins/registry.rb:192:in `lookup_pipeline_plugin‘", "/usr/share/logstash/logstash-core/lib/logstash/plugin.rb:140:in `lookup‘", "/usr/share/logstash/logstash-core/lib/logs

提示缺少 插件 filters/multiline

我们看看logstash都安装了哪些插件

# /usr/share/logstash/bin/logstash-plugin list
logstash-codec-cef
logstash-codec-collectd
logstash-codec-dots
logstash-codec-edn
logstash-codec-edn_lines
logstash-codec-es_bulk
logstash-codec-fluent
logstash-codec-graphite
logstash-codec-json
logstash-codec-json_lines
logstash-codec-line
logstash-codec-msgpack
logstash-codec-multiline
logstash-codec-netflow
logstash-codec-plain
logstash-codec-rubydebug
logstash-filter-aggregate
logstash-filter-anonymize
logstash-filter-cidr
logstash-filter-clone
logstash-filter-csv
logstash-filter-date
logstash-filter-de_dot
logstash-filter-dissect
logstash-filter-dns
logstash-filter-drop
logstash-filter-elasticsearch
logstash-filter-fingerprint
logstash-filter-geoip
logstash-filter-grok
logstash-filter-jdbc_static
logstash-filter-jdbc_streaming
logstash-filter-json
logstash-filter-kv
logstash-filter-metrics
logstash-filter-mutate
logstash-filter-ruby
logstash-filter-sleep
logstash-filter-split
logstash-filter-syslog_pri
logstash-filter-throttle
logstash-filter-translate
logstash-filter-truncate
logstash-filter-urldecode
logstash-filter-useragent
logstash-filter-xml
logstash-input-beats
logstash-input-dead_letter_queue
logstash-input-elasticsearch
logstash-input-exec
logstash-input-file
logstash-input-ganglia
logstash-input-gelf
logstash-input-generator
logstash-input-graphite
logstash-input-heartbeat
logstash-input-http
logstash-input-http_poller
logstash-input-imap
logstash-input-jdbc
logstash-input-kafka
logstash-input-pipe
logstash-input-rabbitmq
logstash-input-redis
logstash-input-s3
logstash-input-snmptrap
logstash-input-sqs
logstash-input-stdin
logstash-input-syslog
logstash-input-tcp
logstash-input-twitter
logstash-input-udp
logstash-input-unix
logstash-output-cloudwatch
logstash-output-csv
logstash-output-elasticsearch
logstash-output-email
logstash-output-file
logstash-output-graphite
logstash-output-http
logstash-output-kafka
logstash-output-lumberjack
logstash-output-nagios
logstash-output-null
logstash-output-pagerduty
logstash-output-pipe
logstash-output-rabbitmq
logstash-output-redis
logstash-output-s3
logstash-output-sns
logstash-output-sqs
logstash-output-stdout
logstash-output-tcp
logstash-output-udp
logstash-output-webhdfs
logstash-patterns-core

有一个logstash-codec-multiline
并没有我们需要的  logstash-filter-multiline

我们来安装这个插件,先看一下  logstash-plugin 的用法

Usage:
    bin/logstash-plugin [OPTIONS] SUBCOMMAND [ARG] ...

Parameters:
    SUBCOMMAND                    subcommand
    [ARG] ...                     subcommand arguments

Subcommands:
    list                          List all installed Logstash plugins
    install                       Install a Logstash plugin
    remove                        Remove a Logstash plugin
    update                        Update a plugin
    pack                          Package currently installed plugins, Deprecated: Please use prepare-offline-pack instead
    unpack                        Unpack packaged plugins, Deprecated: Please use prepare-offline-pack instead
    generate                      Create the foundation for a new plugin
    uninstall                     Uninstall a plugin. Deprecated: Please use remove instead
    prepare-offline-pack          Create an archive of specified plugins to use for offline installation

Options:
    -h, --help                    print help

安装插件是  # logstash-plugin install logstash-filter-multiline

# logstash-plugin install logstash-filter-multiline
Validating logstash-filter-multiline
Installing logstash-filter-multiline
Installation successfu

原文地址:https://www.cnblogs.com/centos2017/p/9306471.html

时间: 2024-10-10 12:13:47

logstash 安装插件multiline的相关文章

logstash 安装插件慢 WARNING: SSLSocket#session= is not supported

问题:安装插件慢 [email protected]:/work/opt/logstash# bin/logstash-plugin install logstash-output-kinesis Validating logstash-output-kinesis Installing logstash-output-kinesis WARNING: SSLSocket#session= is not supported 解决: 更换为国内源 [[email protected] logsta

ELK部署logstash安装部署及应用(二)

Logstash 安装部署注意事项: Logstash基本概念: logstash收集日志基本流程: input-->codec-->filter-->codec-->output input:从哪里收集日志. filter:发出去前进行过滤 output:输出至Elasticsearch或Redis消息队列 codec:输出至前台,方便边实践边测试 数据量不大日志按照月来进行收集 如果通过logstash来采集日志,那么每个客户端都需要安装logstash 安装需要前置系统环境

日志监控_ElasticStack-0003.Logstash输入插件及实际生产案例应用?

新版插件: 说明: 从5.0开始,插件都独立拆分成gem包,每个插件可独立更新,无需等待Logstash自身整体更新,具体管理命令可参考./bin/logstash-plugin --help帮助信息../bin/logstash-plugin list其实所有的插件就位于本地./vendor/bundle/jruby/1.9/gems/目录下 扩展: 如果GitHub上面(https://github.com/logstash-plugins/)发布了扩展插件,可通过./bin/logstas

Logstash的插件

Logstash的插件: input插件: File:从指定的文件中读取事件流: 使用FileWatch(Ruby Gem库)监听文件的变化. .sincedb:记录了每个被监听的文件的inode, major number, minor nubmer, pos; 一下是一个收集日志简单的示例: input { file { path => ["/var/log/messages"] type => "system" start_position =&g

logstash常用插件解析

官方地址:https://www.elastic.co/guide/en/logstash-versioned-plugins/current/index.html 配置文件写法: # 日志导入input {}# 日志筛选匹配处理filter {}# 日志匹配输出output {} 日志解析配置文件的框架共分为三个模块,input,output,filter.后面会一一讲解, 每个模块里面存在不同的插件. input 模块 列子1 # file为常用文件插件,插件内选项很多,可根据需求自行判断i

Logstash安装介绍

前言 logstash是ELK日志系统中的一部分,主要承担将收集完成日志进行过滤,并且输出到es的职责. logstash本身也可以作为客户端部署到应用系统的服务器上进行日志收集,但是由于资源开销占用过大,所以客户端的收集工作交给了beats进行,logstash专心在独立的服务器上完成日志解析处理的工作. 官方文档说明:https://www.elastic.co/guide/en/logstash/ 这里比较建议直接看英文的说明文档,找到你对应的版本,别的文档感觉都不如它靠谱(血与泪的教训?

Eclipse 安装插件

Eclipse插件的安装方法大体有以下三种: 第一种:直接复制法 假设你的Eclipse的在(C:\eclipse), 解压你下载的 eclipse 插件或者安装eclipse 插件到指定目录AA(c:\AA)文件夹,打开AA 文件夹,在AA文件夹里分别包含两个文件夹features和plugins ,然后把两个文件夹里的文件分别复制到eclipse下所对应的文件夹下的features 和plugins 下,一般的把插件文件直接复制 到eclipse目录里是最直接也是最愚蠢的一种方法!因为日后想

Eclipse安装插件方式介绍

eclipse安装插件的常用方式有多种: 1.在线安装 打开eclipse,选择"help" --> "Install New Software..." --> "Add",输入Name信息与URL信息,点击"OK". 2.离线安装包安装 打开eclipse,选择"help" --> "Install New Software..." --> "Add&

Xcode安装插件的坑

安装插件失败解决 1.打开”终端”后输入下面代码并回车(是为了显示隐藏的文件夹):defaults write com.apple.finder AppleShowAllFiles -bool true 2.打开插件找到info.plist 文件,找到DVTPlugInCompatibilityUUIDs的项目, 3.添加C4A681B0-4A26-480E-93EC-1218098B9AA0(当前xcode的一个号码),这个号码怎么得到?在终端执行 defaults read /Applica