zoukankan      html  css  js  c++  java
  • (五)ELK Logstash output

    # 输出插件将数据发送到一个特定的目的地, 除了elasticsearch还有好多可输出的地方, 例如file, csv, mongodb, redis, syslog等
    output {
        if [type] == "apache_access"{
            elasticsearch {
                hosts => [ "localhost:9200" ]
                # 记录的index索引名称格式
                index => "apache-access-log-%{+YYYY.MM}"
            }
        } else if [type] == "apache_error"{
            elasticsearch {
                hosts => [ "localhost:9200" ]
                index => "apache-error-log"
            }
        }
    }
    
    elasticsearch{  
        hosts=>["172.132.12.3:9200"]  
        action=>"index"  
        index=>"indextemplate-logstash"  
        #document_type=>"%{@type}"  
        document_id=>"ignore"  
          
        template=>"/opt/logstash-conf/es-template.json"  
        template_name=>"es-template.json"  
        template_overwrite=>true       
    }
    

      

    action=>”index” #es要执行的动作 index, delete, create, update
        index:将logstash.时间索引到一个文档
        delete:根据id删除一个document(这个动作需要一个id)
        create:建立一个索引document,如果id存在 动作失败.
        update:根据id更新一个document,有一种特殊情况可以upsert--如果document不是已经存在的情况更新document 。参见upsert选项。
    
    document_id=>” ” 为索引提供document id ,对重写elasticsearch中相同id词目很有用
    document_type=>” ”事件要被写入的document type,一般要将相似事件写入同一type,可用%{}引用事件type,默认type=log
    index=>”logstash-%{+YYYY,MM.dd}” 事件要被写进的索引,可是动态的用%{foo}语句
    hosts=>[“127.0.0.0”] ["127.0.0.1:9200","127.0.0.2:9200"] "https://127.0.0.1:9200" 
    manage_template=>true 一个默认的es mapping 模板将启用(除非设置为false 用自己的template)
    template=>”” 有效的filepath 设置自己的template文件路径,不设置就用已有的
    template_name=>”logstash” 在es内部模板的名字
    

      

  • 相关阅读:
    Mac下安装Mysql
    事务隔离级别
    Mysql和Orcale的区别
    springboot的优点
    spring boot注解
    spring boot 常用注解
    java链接Mysql出现警告:Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by
    SpringApplication及banner的配置
    交叉编译
    qt下载和安装记录
  • 原文地址:https://www.cnblogs.com/xiao2er/p/10491141.html
Copyright © 2011-2022 走看看