尊龙凯时人生就是搏

ÔõÑùÔÚLinuxÇéÐÎÖÐʹÓÃELK Stack¾ÙÐÐÈÕÖ¾ÆÊÎö£¿

ÔõÑùÔÚlinuxÇéÐÎÖÐʹÓÃelk stack¾ÙÐÐÈÕÖ¾ÆÊÎö£¿

Ò»¡¢ELK Stack¼ò½é

ELK StackÊÇÓÉÈý¸ö¿ªÔ´Èí¼þElasticsearch¡¢LogstashºÍKibana×é³ÉµÄÈÕÖ¾ÆÊÎöƽ̨¡£ElasticsearchÊÇÒ»¸öÂþÑÜʽµÄʵʱËÑË÷ºÍÆÊÎöÒýÇ棬LogstashÊÇÒ»¸öÓÃÓÚÍøÂç¡¢´¦ÀíºÍת·¢ÈÕÖ¾µÄ¹¤¾ß£¬KibanaÊÇÒ»¸öÓÃÓÚ¿ÉÊÓ»¯ºÍÆÊÎöÈÕÖ¾µÄ½çÃæ¡£

¶þ¡¢×°ÖÃELK Stack

×°ÖÃElasticsearch

(1) ÏÂÔØ×îа汾µÄElasticsearch£º

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.15.2-linux-x86_64.tar.gz

µÇ¼ºó¸´ÖÆ

(2) ½âѹËõ×°Öðü£º

tar -zxvf elasticsearch-7.15.2-linux-x86_64.tar.gz

µÇ¼ºó¸´ÖÆ

(3) ÔËÐÐElasticsearch£º

cd elasticsearch-7.15.2/bin
./elasticsearch

µÇ¼ºó¸´ÖÆ

(4) ÑéÖ¤ElasticsearchÊÇ·ñÕý³£ÔËÐУ¬ÔÚä¯ÀÀÆ÷Öлá¼ûhttp://localhost:9200£¬ÈôÊÇ·µ»ØÒÔÏÂÐÅÏ¢ÌåÏÖ×°ÖÃÀֳɣº

{
  "name" : "xxxx",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "xxxx",
  "version" : {
    "number" : "7.15.2",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "xxxx",
    "build_date" : "xxxx",
    "build_snapshot" : false,
    "lucene_version" : "xxxx",
    "minimum_wire_compatibility_version" : "xxxx",
    "minimum_index_compatibility_version" : "xxxx"
  },
  "tagline" : "You Know, for Search"
}

µÇ¼ºó¸´ÖÆ

×°ÖÃLogstash

(1) ÏÂÔØ×îа汾µÄLogstash£º

wget https://artifacts.elastic.co/downloads/logstash/logstash-7.15.2.tar.gz

µÇ¼ºó¸´ÖÆ

(2) ½âѹËõ×°Öðü£º

tar -zxvf logstash-7.15.2.tar.gz

µÇ¼ºó¸´ÖÆ

(3) ½¨ÉèÒ»¸öLogstashÉèÖÃÎļþ£¬Èçlogstash.conf£º

input {
  file {
    path => "/var/log/nginx/access.log"
    start_position => "beginning"
  }
}

filter {
  grok {
    match => { "message" => "%{COMBINEDAPACHELOG}" }
  }
}

output {
  elasticsearch {
    hosts => ["localhost:9200"]
    index => "nginx-access-log"
  }
  stdout { codec => rubydebug }
}

µÇ¼ºó¸´ÖÆ

ÉÏÊöÉèÖÃÎļþÖ¸¶¨ÁËÊäÈëµÄÈÕ־·¾¶¡¢Ê¹ÓÃGrokģʽƥÅäÈÕÖ¾ÃûÌᢽ«´¦ÀíºóµÄÈÕÖ¾·¢Ë͵½Elasticsearch£¬²¢Í¨¹ýstdout²å¼þÔÚÖÕ¶ËÊä³öµ÷ÊÔÐÅÏ¢¡£

(4) ÔËÐÐLogstash£º

cd logstash-7.15.2/bin
./logstash -f logstash.conf

µÇ¼ºó¸´ÖÆ

×¢ÖØ£ºÐèҪƾ֤ÏÖÕæÏàÐÎÐÞ¸Älogstash.confµÄÉèÖÃÐÅÏ¢¡£

×°ÖÃKibana

(1) ÏÂÔØ×îа汾µÄKibana£º

wget https://artifacts.elastic.co/downloads/kibana/kibana-7.15.2-linux-x86_64.tar.gz

µÇ¼ºó¸´ÖÆ

(2) ½âѹËõ×°Öðü£º

tar -zxvf kibana-7.15.2-linux-x86_64.tar.gz

µÇ¼ºó¸´ÖÆ

(3) ÐÞ¸Äconfig/kibana.ymlÎļþ£¬ÉèÖÃElasticsearchµÄµØµã£º

elasticsearch.hosts: ["http://localhost:9200"]

µÇ¼ºó¸´ÖÆ

(4) ÔËÐÐKibana£º

cd kibana-7.15.2/bin
./kibana

µÇ¼ºó¸´ÖÆ

(5) ÔÚä¯ÀÀÆ÷Öлá¼ûhttp://localhost:5601£¬ÈôÊÇÄÜ¿´µ½KibanaµÄ½çÃæÌåÏÖ×°ÖÃÀֳɡ£

Èý¡¢Ê¹ÓÃELK Stack¾ÙÐÐÈÕÖ¾ÆÊÎö

ELK Stack×°ÖÃÍê³Éºó£¬¾Í¿ÉÒÔ×îÏȾÙÐÐÈÕÖ¾ÆÊÎöÁË¡£

ÍøÂçÈÕÖ¾

ÔÚLogstashµÄÉèÖÃÎļþÖУ¬¿ÉÒÔÉèÖöàÖÖȪԴµÄÈÕÖ¾£¬ºÃ±ÈÎļþ¡¢ÍøÂçµÈ¡£ÐÞ¸ÄLogstashµÄÉèÖÃÎļþ£¬Ö¸¶¨×¼È·µÄÈÕ־ȪԴ£¬²¢¾ÙÐÐÏìÓ¦µÄÃûÌû¯´¦Àí¡£

´¦ÀíºÍת·¢ÈÕÖ¾

LogstashÊÇÒ»¸öÇ¿Ê¢µÄÈÕÖ¾´¦Àí¹¤¾ß£¬Ëü¿ÉÒÔͨ¹ýÄÚÖõIJå¼þÀ´¾ÙÐÐÈÕÖ¾µÄ´¦ÀíºÍת·¢¡£ÔÚÉèÖÃÎļþµÄfilter²¿·Ö£¬¿ÉÒÔʹÓÃһϵÁеIJå¼þ¶ÔÈÕÖ¾¾ÙÐÐÆÊÎö¡¢¹ýÂ˺ÍÃûÌû¯¡£

´æ´¢ºÍË÷ÒýÈÕÖ¾

ÔÚLogstashµÄÉèÖÃÎļþµÄoutput²¿·Ö£¬¿ÉÒÔÉèÖÃÈÕÖ¾µÄ´æ´¢ºÍË÷Òý·½·¨¡£ElasticsearchÊÇÒ»¸öÂþÑÜʽµÄËÑË÷ÒýÇ棬ËüÄܹ»¿ìËٵش洢ºÍ¼ìË÷´ó×ÚµÄÊý¾Ý¡£¿ÉÒÔͨ¹ýÉèÖÃElasticsearchµÄhostsºÍindex²ÎÊý£¬½«´¦ÀíºóµÄÈÕÖ¾´æ´¢µ½ÏìÓ¦µÄË÷ÒýÖС£

¿ÉÊÓ»¯ºÍÆÊÎöÈÕÖ¾

KibanaÊÇELK StackµÄ¿ÉÊÓ»¯¹¤¾ß£¬ËüÌṩÁ˸»ºñµÄͼ±íºÍÒDZíÅÌÀ´Õ¹Ê¾ºÍÆÊÎöÈÕÖ¾Êý¾Ý¡£ÔÚKibanaÖУ¬¿ÉÒÔͨ¹ý½¨ÉèË÷Òýģʽ¡¢¿ÉÊÓ»¯ºÍÒDZíÅÌÀ´×Ô½ç˵ÖÖÖÖͼ±íºÍ±¨±í£¬ÒÔÖª×ã²î±ðµÄÐèÇó¡£

ËÄ¡¢×ܽá

ELK StackÊÇÒ»¸öÇ¿Ê¢¶øÎÞаµÄÈÕÖ¾ÆÊÎöƽ̨£¬¿ÉÒÔ×ÊÖúÎÒÃÇÍøÂç¡¢´¦Àí¡¢´æ´¢¡¢¿ÉÊÓ»¯ºÍÆÊÎöÈÕÖ¾Êý¾Ý¡£Ö»Ðè¼òÆӵļ¸²½¾Í¿ÉÒÔÔÚLinuxÇéÐÎÖÐ×°ÖúÍÉèÖÃELK Stack£¬È»ºó¾Í¿ÉÒÔƾ֤ÏÖʵÐèÇó¾ÙÐÐÈÕÖ¾ÆÊÎöÁË¡£Í¨¹ýÕâÖÖ·½·¨£¬ÎÒÃÇ¿ÉÒÔ¸üºÃµØÃ÷È·ºÍʹÓÃÈÕÖ¾Êý¾Ý£¬´Ó¶øÓÅ»¯ÏµÍ³ÐÔÄÜ¡¢·¢Ã÷DZÔÚÎÊÌâºÍË¢ÐÂÓû§ÌåÑé¡£

ÒÔÉϾÍÊÇÔõÑùÔÚLinuxÇéÐÎÖÐʹÓÃELK Stack¾ÙÐÐÈÕÖ¾ÆÊÎö£¿µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í尊龙凯时人生就是搏ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ尊龙凯时人生就是搏ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ尊龙凯时人生就是搏

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎ壬9:30-18:30£¬½ÚãåÈÕÐÝÏ¢

QR code
sitemap¡¢ÍøÕ¾µØͼ