Diferències

Ací es mostren les diferències entre la revisió seleccionada i la versió actual de la pàgina.

Enllaç a la visualització de la comparació

Ambdós costats versió prèvia Revisió prèvia
Següent revisió
Revisió prèvia
info:cursos:pue:devops2022:s15 [09/02/2022 09:21] mateinfo:cursos:pue:devops2022:s15 [30/03/2022 12:03] (actual) mate
Línia 1: Línia 1:
-= DevOps Sesión 15 (2022-03-30)+= DevOps Sesión 15 (2022-03-30) ELK
 == Documentación relacionada == Documentación relacionada
-== Clase+<callout type="info" icon="true"> 
 +  * ./5-Topic 705 Service Operations/Material Curso ELK/1-Laboratorios ELK.pdf 
 +  * ./5-Topic 705 Service Operations/Presentacion Herramientas para el manejo de logs.pdf 
 +  * ./5-Topic 705 Service Operations/Clase Monitorizacion.txt 
 +</callout> 
 +== packetbeat 
 +  * [[https://www.elastic.co/guide/en/beats/packetbeat/current/index.html]] 
 +  * [[https://www.elastic.co/es/downloads/beats/packetbeat]] 
 +  * ./5-Topic 705 Service Operations/Material Curso ELK/1-Laboratorios ELK.pdf pag 37 
 +  * <code bash>rpm -ivh /root/packetbeat-7.0.0-x86_64.rpm</code> 
 +  * <code yaml ; /etc/packetbeat/packetbeat.yml> 
 +14 packetbeat.interfaces.device: any # packetbeat devices (se pueden usar nombres o posición) 
 +131 setup.dashboards.enabled: true 
 +149   host: "192.168.93.128:5601" 
 +223 xpack.monitoring.enabled: true 
 +230 xpack.monitoring.elasticsearch: 
 +</code> 
 +  * <code bash>packetbeat devices 
 +packetbeat test config -c packetbeat.yml 
 +systemctl start packetbeat.service 
 +systemctl status packetbeat.service 
 +</code> 
 +  * En Kibana, vamos **Dashboard** y buscamos **Packetbeat Flows ECS** 
 + 
 +== auditbeat 
 +  * ./5-Topic 705 Service Operations/Material Curso ELK/1-Laboratorios ELK.pdf pag 55 
 + 
 +== logstash 
 +  * ./5-Topic 705 Service Operations/Clase Monitorizacion.txt línea 151 
 +  * ./5-Topic 705 Service Operations/Material Curso ELK/1-Laboratorios ELK.pdf pag 59 
 +  * preprocesador 
 +  * {{:info:cursos:pue:devops2022:pasted:20220330-092805.png}} 
 +  * codec: es una transformación en la salida que va a hacer logstash con la información que estemos trabajando, es decir un codec es si a mi me llega en un formato que logstash ya entiende lo que puede hacer logstash es enviarla en un formato concreto, por ejemplo ahora utiliza el codec de JSON para que me la devuelva en este formato. 
 +=== lab 
 +  * <code> 
 +input { 
 + stdin {} 
 +
 + 
 +output { 
 + stdout { 
 + codec => json_lines 
 +
 +
 +</code> -> convierte la entrada de teclado en cadenas JSON (y más info) 
 +  * <code bash>cp /elk/example.conf  /etc/logstash/ 
 +/usr/share/logstash/bin/logstash -f /etc/logstash/example.conf</code> 
 + 
 +=== lab codec multiline 
 +  * <code example-codec-multiline.conf> 
 +input { 
 + stdin { 
 + codec => multiline { 
 + pattern => "^fin" 
 + negate => "true" 
 + what => "next" 
 +
 +
 +
 + 
 +output { 
 + stdout { 
 + codec => json_lines 
 +
 +
 +</code> 
 +  * <code bash>cp /elk/example-codec-multiline.conf /etc/logstash/ 
 +/usr/share/logstash/bin/logstash -f /etc/logstash/example-codec-multiline.conf 
 +</code> 
 + 
 +=== lab file 
 +  * [[https://www.elastic.co/guide/en/logstash/current/plugins-inputs-file.html]] 
 +  * <code ; example-codec-file.conf> 
 +input { 
 + file { 
 + path => "/logs/access_log" 
 + exclude => "*.gz" 
 + start_position => "beginning" 
 + sincedb_path => "/logs/access.sincedb" 
 +
 +
 + 
 +output { 
 + stdout { 
 + codec => json_lines 
 +
 +}</code> 
 +    * **sincedb_path**: no rutas relativas, puntero que indica la posición "leída" (por si se corta) 
 +  * <code bash>/usr/share/logstash/bin/logstash -f /etc/logstash/example-codec-file.conf</code> 
 +  * <code ; example-codec-file-2.conf> 
 +input { 
 + file { 
 + path => "/logs/log-generator*.log" 
 + exclude => "*.gz" 
 + start_position => "beginning" 
 + sincedb_path => "/logs/log-generator.sincedb" 
 + codec => multiline { 
 + pattern => "^(DEBUG|INFO|ERROR|TRACE|FATAL|WARN).*" 
 + negate => "true" 
 + what => "previous" 
 +
 +
 +
 + 
 +output { 
 + stdout { 
 + # codec => json_lines 
 +
 +}</code> 
 +  * <code bash>/usr/share/logstash/bin/logstash -f /etc/logstash/example-codec-file-2.conf </code> 
 + 
 +=== lab filebeat 
 +  * <code bash>rpm -ivh /root/filebeat-6.7.1-x86_64.rpm</code> 
 +  * <code> 
 +29     - /logs/log-generator.log 
 +149 #output.elasticsearch: 
 +150   # Array of hosts to connect to. 
 +151   #hosts: ["localhost:9200"
 +162 output.logstash: 
 +163   # The Logstash hosts 
 +164   hosts: ["localhost:5044"
 +</code> 
 +  * <code  ; example-beat.conf> 
 +input { 
 + beats { 
 + port => 5044 
 +
 +
 + 
 +output { 
 + stdout {} 
 +}</code> 
 +  * <code bash> 
 +systemctl start filebeat.service 
 +/usr/share/logstash/bin/logstash -f /etc/logstash/example-beat.conf</code> 
 + 
 +== filters: grok 
 +  * [[https://www.elastic.co/guide/en/logstash/current/plugins-filters-grok.html]] 
 +  * [[https://grokdebug.herokuapp.com/]] 
 +  * Kibana -> Dev Tools -> Grok Debugger 
 +  * https://programmerclick.com/article/74971006708/ 
 +  * https://github.com/logstash-plugins/logstash-patterns-core/tree/main/patterns/ecs-v1 
 +  * https://github.com/logstash-plugins/logstash-patterns-core/tree/main/patterns 
 + 
 +=== inputs 
 +=== filters 
 +=== outputs 
 == TODO == TODO
 <callout type="info" icon="true"></callout> <callout type="info" icon="true"></callout>
  • info/cursos/pue/devops2022/s15.1644427311.txt.gz
  • Darrera modificació: 09/02/2022 09:21
  • per mate