Ubuntu中ELK安装和调试的一些要点

前端之家收集整理的这篇文章主要介绍了Ubuntu中ELK安装和调试的一些要点前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

1. Query all records from Elasticsearch

curl -XGET "http://localhost:9200/logstash-*/_search?size=50&pretty"

http://stackoverflow.com/a/38874465/2177408


2. Run logstash

  1. /opt/logstash/bin/logstash -f /etc/logstash/conf.d/logstash.conf

3. Linux 命令(netstat,ps,kill)

  1. On Linux (Ubuntu derivatives at least)
  2.  
  3. killall node
  4. is easier than this form.
  5.  
  6. ps | grep <something>
  7. kill <somepid>
  8. Neither will work if you have a orphaned child holding the port. Instead,do this:
  9.  
  10. netstat -punta | grep <port>
  11. If the port is being held you'll see something like this:
  12.  
  13. tcp 0 0.0.0.0:<port> 0.0.0.* LISTEN <pid>/<parent>
  14. Now kill by pid:
  15.  
  16. kill -9 <pid>

http://stackoverflow.com/a/22875192/2177408


4. Delete all data of an index in elasticsearch
  1. curl -XDELETE localhost:9200/index/type/documentID
http://stackoverflow.com/a/22932471/2177408

5. Match IPV4 and IPV6 in COMBINEDAPACHELOGS

  1. %{IPV6:ipv6}:%{IPV4:ipv4}
http://stackoverflow.com/a/40084695/2177408


6. Multiple matches in grok in logstash

  1. input {
  2. stdin{}
  3. }
  4. filter {
  5. grok {
  6. break_on_match => false
  7. match => [ "message","%{WORD:word1}" ]
  8. match => [ "message","%{WORD:word2}" ]
  9. match => [ "message","%{WORD:word3}" ]
  10. }
  11. }
  12. output {
  13. stdout { codec => rubydebug }
  14. }



7. Regex for COMBINEDAPACHELOGS

  1. grok {
  2. match => [ "message","%{IP:client_ip} %{USER:ident} %{USER:auth} \[%{HTTPDATE:apache_timestamp}\] \"%{WORD:method} /%{NOTSPACE:request_page} HTTP/%{NUMBER:http_version}\" %{NUMBER:server_response} " ]
  3. }
http://stackoverflow.com/a/22380896/2177408

8. After updating logstash.conf

  1. rm .sincedb*
  2. curl -XDELETE localhost:9200/logstash-*
  3. sudo /etc/init.d/logstash stop
  4. sudo /etc/init.d/logstash start

猜你在找的Ubuntu相关文章