Comment utiliser Elasticsearch, Logstash et Kibana pour gérer les logs Apache d’OVH PARTIE 2

Comment utiliser Elasticsearch, Logstash et Kibana pour gérer les logs Apache d’OVH PARTIE 2

Les différentes étapes sont expliquées pour une installation sur Mac OS 10.x

 

Installation de Elasticsearch

$ brew update
$ brew install elasticsearch

 

Installation de Logstash

$ brew update
$ brew install logstash

 

Installation de Kibana

$ brew update
$ brew install kibana

Démarrer Elasticsearch et Kibana en service

Création des services

$ ln -sfv /usr/local/opt/elasticsearch/*.plist ~/Library/LaunchAgents
$ ln -sfv /usr/local/opt/kibana/*.plist ~/Library/LaunchAgents

 

pour lancer les deux service sans redémarer :

launchctl load ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.kibana.plist

 

Configuration du .BASH_PROFILE VARIABLES

$ nano ~/.bash_profile

 

Ajouter les lignes suivantes :

export ES_HOME=/usr/local/opt/elasticsearch
export KB_HOME=/usr/local/opt/kibana
export LOG_HOME=/usr/local/opt/logstash
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Ho$
export PATH=$ES_HOME/bin:$KB_HOME/bin:$LOG_HOME/bin:$JAVA_HOME/bin:$PATH

 

Variante : démarrer Elastisearch et Kibana en ligne de commande

$ elasticsearch
$ kibana

 

Vérification du bon fonctionnement
Lancer votre navigateur et tester les deux URL suivantes :

Elastisearch

http://localhost:9200/

Elastisearch doit répondre un truc du genre :

{
"name" : "XCGiBbC",
"cluster_name" : "elasticsearch_arnaud",
"cluster_uuid" : "T5HZ5aGwRuuXg26f98fcnA",
"version" : {
"number" : "6.2.0",
"build_hash" : "37cdac1",
"build_date" : "2018-02-01T17:31:12.527918Z",
"build_snapshot" : false,
"lucene_version" : "7.2.1",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}

 

Kibana

http://localhost:5601/

Vous devez arriver sur l’interface web de Kibana qui va permettre de créer vos monitorings

kibana