logstash

https://www.elastic.co/guide/en/logstash/current/index.html

支持的插件

https://www.elastic.co/guide/en/logstash/current/input-plugins.html

 

Logstash is an open source, server-side data processing pipeline that ingests data from a multitude of sources simultaneously, transforms it, and then sends it to your favorite “stash.” (Ours is Elasticsearch, naturally.)

 

To verify your configuration, run the following command:

bin/logstash -f first-pipeline.conf --config.test_and_exit

The --config.test_and_exit option parses your configuration file and reports any errors.

If the configuration file passes the configuration test, start Logstash with the following command:

bin/logstash -f first-pipeline.conf --config.reload.automatic

The --config.reload.automatic option enables automatic config reloading so that you don’t have to stop and restart Logstash every time you modify the configuration file.

If your pipeline is working correctly, you should see a series of events like the following written to the console:

 

cd logstash-5.5.1

bin/logstash -'input { stdin { } } output { stdout {} }’

bin/logstash-plugin list 

bin/logstash-plugin list --verbose 

bin/logstash-plugin list '*namefragment*' 

bin/logstash-plugin list --group output 

 

Will list all installed plugins


Will list installed plugins with version information


Will list all installed plugins containing a namefragment


Will list all installed plugins for a particular group (input, filter, codec, output)

安装插件

bin/logstash-plugin install logstash-output-kafka

更新插件

bin/logstash-plugin update 

bin/logstash-plugin update logstash-output-kafka 


will update all installed plugins


will update only this plugin

删除插件

bin/logstash-plugin remove logstash-output-kafka

 

安装jdbc的插件

bin/logstash-plugin install logstash-input-jdbc

 

input {

  jdbc {

    jdbc_driver_library => "/Users/jiaozhiguang/.m2/repository/mysql/mysql-connector-java/6.0.6/mysql-connector-java-6.0.6.jar"

    jdbc_driver_class => "com.mysql.jdbc.Driver"

    jdbc_connection_string => "jdbc:mysql://localhost:3306/test"

    jdbc_user => "admin"

    jdbc_password => "admin"

    schedule => "* * * * *"

    statement => "SELECT * from sys_permission"

  }

}

output {

    elasticsearch {

        hosts => [ "localhost:9200" ]

    }

}

 

Predefined Parametersedit

Some parameters are built-in and can be used from within your queries. Here is the list:

sql_last_value

 

The value used to calculate which rows to query. Before any query is run, this is set toThursday, 1 January 1970, or 0 if use_column_value is true and tracking_column is set. It is updated accordingly after subsequent queries are run.

Example:

input {

  jdbc {

    statement => "SELECT id, mycolumn1, mycolumn2 FROM my_table WHERE id > :sql_last_value"

    use_column_value => true

    tracking_column => "id"

    # ... other configuration bits

  }

}

 

filter {

    json {

        source => "message"

        remove_field => ["message"]

    }

}

 

output {

    elasticsearch {

        host => "192.168.0.199"

        port => "9200"

        protocol => "http"

        index => "mysql01"

        document_id => "%{id}"

        cluster => "logstash-elasticsearch"

    }

    stdout {

        codec => json_lines

    }

}

 

全文检索

POST /megacorp/employee/_search
{
    "query" : {
        "match" : {
            "about" : "rock climbing"
        }
    }
}

 

Kibana

https://www.elastic.co/products/kibana

 

https://www.elastic.co/guide/en/kibana/current/index.html

 

启动

./bin/kibana

 

http://localhost:5601/

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值