SlideShare ist ein Scribd-Unternehmen logo
1 von 25
Downloaden Sie, um offline zu lesen
COMO ENCONTRAR UMA
AGULHA NUM PALHEIRO
DE LOGS
DICKSON S. GUEDES
@GUEDIZ
FISL16 (2015) - PORTO ALEGRE, RS
UMA ANALOGIA SOBRE AGULHA E O PALHEIRO
QUE FERRAMENTAS PERMITIRIAM ENCONTRAR
AGULHAS EM UM PALHEIRO?
QUE CARACTERÍSTICAS A AGULHA DEVE
POSSUIR PARA SER ENCONTRADA?
UM REGISTRO ESPECIFICO DE LOG SERIA NOSSA
AGULHA
TODOS OS DEMAIS REGISTROS SERIAM NOSSO
PALHEIRO
PORQUE REGISTRAMOS EVENTOS?
auditoria
monitoramento
recuperação de dados
diagnósticos
MAIS DO QUE ISSO, O LOG É UMA INTERFACE DE
USUÁRIO
quando?
quem?
onde?
como?
o quê?
QUE CARACTERÍSTICAS UM LOG PRECISA TER
PARA SER ENCONTRADO?
obter
parsear
filtrar
minerar
representar
refinar
interagir
QUE ETAPAS PRECISARÍAMOS SEGUIR?
bash, grep, awk, sed, ruby, python, perl …
syslog
Usar uma pilha pronta como a ELK:
Montar sua própria pilha
QUEM SERIA NOSSO IMÃ?
Elasticsearch Logstash Kibana
PostgreSQL Hadoop Flume Fluentd GNUplot
D3.js
e podem nos ajudar a enxergar melhor …
apresentar CSS e HTML e imagens é o mínimo que se espera
manipulação da DOM
manipulação de imagens SVG
"OS NAVEGADORES ESTÃO MAIS MODERNOS"
NOSSO EXEMPLO DE HOJE
Logstash
Elasticsearch
Kibana
D3.js
pipeline
input | filter | output
file | grep | csv
twitter | grep | json
imap | ruby | xmpp
file | grok | elasticsearch
LOGSTASH
banco de dados não relacional
indices
documentos
fields
full text search
ELASTICSEARCH
visualização
dashboard
KIBANA
visualização turbinada
D3.JS
SHOW ME THE CODE!
cd $work
mkdir downloads
cd downloads
wget https://download.elastic.co/elasticsearch/elasticsearch/elasticsear
ch-1.6.0.tar.gz
wget https://download.elastic.co/logstash/logstash/logstash-1.5.2.tar.gz
wget https://download.elastic.co/kibana/kibana/kibana-4.1.1-linux-x64.ta
r.gz
cd ..
tar zxvf download/elasticsearch-1.6.0.tar.gz
tar zxvf download/kibana-4.1.1-linux-x64.tar.gz
tar zxvf download/logstash-1.5.2.tar.gz
./elasticsearch-1.6.0/bin/elasticsearch
curl -X GET http://localhost:9200
# {
# "status" : 200,
# "name" : "Kick-Ass",
# "cluster_name" : "elasticsearch",
# "version" : {
# "number" : "1.6.0",
# "build_hash" : "cdd3ac4dde4f69524ec0a14de3828cb95bbb86d0",
# "build_timestamp" : "2015-06-09T13:36:34Z",
# "build_snapshot" : false,
# "lucene_version" : "4.10.4"
# },
# "tagline" : "You Know, for Search"
# }
./logstash-1.5.2/bin/logstash -e 'input { stdin { } } output { stdout {
} }'
# Logstash startup completed
teste
# 2015-07-08T21:42:43.129Z dba01 teste
ola mundo
# 2015-07-08T21:42:47.899Z dba01 ola mundo
^C
# SIGINT received. Shutting down the pipeline. {:level=>:warn}
# Logstash shutdown completed
./logstash-1.5.2/bin/logstash -e 'input { stdin { } } output { stdout {
codec => rubydebug } }'
# Logstash startup completed
ola mundo!
# {
# "message" => "ola mundo!",
# "@version" => "1",
# "@timestamp" => "2015-07-08T21:44:00.804Z",
# "host" => "dba01"
# }
teste
# {
# "message" => "teste",
# "@version" => "1",
# "@timestamp" => "2015-07-08T21:45:00.075Z",
# "host" => "dba01"
# }
./logstash-1.5.2/bin/logstash -e 'input { stdin { } } output { elasticse
arch { } }'
# Jul 08, 2015 6:48:49 PM org.elasticsearch.node.internal.InternalNode <
init>
# INFORMAÇÕES: [logstash-dba01-8559-11620] version[1.5.1], pid[8559], bu
ild[5e38401/2015-04-09T13:4
# 1:35Z]
# Jul 08, 2015 6:48:49 PM org.elasticsearch.node.internal.InternalNode <
init>
# INFORMAÇÕES: [logstash-dba01-8559-11620] initializing ...
# Jul 08, 2015 6:48:49 PM org.elasticsearch.plugins.PluginsService <init
>
# INFORMAÇÕES: [logstash-dba01-8559-11620] loaded [], sites []
# Jul 08, 2015 6:48:50 PM org.elasticsearch.node.internal.InternalNode <
init>
# INFORMAÇÕES: [logstash-dba01-8559-11620] initialized
# Jul 08, 2015 6:48:50 PM org.elasticsearch.node.internal.InternalNode s
tart
# INFORMAÇÕES: [logstash-dba01-8559-11620] starting ...
# Jul 08, 2015 6:48:50 PM org.elasticsearch.transport.TransportService d
oStart
# INFORMAÇÕES: [logstash-dba01-8559-11620] bound_address {inet[/0:0:0:0:
0:0:0:0:9301]}, publish_add
# ress {inet[/10.1.6.88:9301]}
# Jul 08, 2015 6:48:50 PM org.elasticsearch.discovery.DiscoveryService d
oStart
# INFORMAÇÕES: [logstash-dba01-8559-11620] elasticsearch/4htwknhiS2S9swI
vVsWTxQ
# Jul 08, 2015 6:48:53 PM org.elasticsearch.cluster.service.InternalClus
terService$UpdateTask run
# INFORMAÇÕES: [logstash-dba01-8559-11620] detected_master [Kick-Ass][-e
atoEY8TWecIb34yKjM8w][dba01
# ][inet[/10.1.6.88:9300]], added {[Kick-Ass][-eatoEY8TWecIb34yKjM8w][db
a01][inet[/10.1.6.88:9300]]
# ,}, reason: zen-disco-receive(from master [[Kick-Ass][-eatoEY8TWecIb34
yKjM8w][dba01][inet[/10.1.6
# .88:9300]]])
# Jul 08, 2015 6:48:53 PM org.elasticsearch.node.internal.InternalNode s
tart
# INFORMAÇÕES: [logstash-dba01-8559-11620] started
# Logstash startup completed
# no elasticsearch
# [2015-07-08 18:48:53,736][INFO ][cluster.service ] [Kick-Ass] added
# {[logstash-dba01-8559-11620][4htwknhiS2S9swIvVsWTxQ][dba01][inet[/10.1
.6.88:9301]]{client=true,
# data=false},}, reason: zen-disco-receive(join from
# node[[logstash-dba01-8559-11620][4htwknhiS2S9swIvVsWTxQ][dba01][inet[/
10.1.6.88:9301]]{client=true,
# data=false}])
# no logstash
teste 123
teste 123 4
# em outro shell
curl 'http://localhost:9200/_search?pretty'
# {
# "took" : 1,
# "timed_out" : false,
# "_shards" : {
# "total" : 5,
# "successful" : 5,
# "failed" : 0
# },
# "hits" : {
# "total" : 3,
# "max_score" : 1.0,
# "hits" : [ {
# "_index" : "logstash-2015.07.08",
# "_type" : "logs",
# "_id" : "AU5vpqcN6gKLePtWPjrH",
# "_score" : 1.0,
# "_source":{"message":"teste 123","@version":"1","@timestamp":"20
15-07-08T21:51:09.580Z","host":"dba01"}
# }, {
# "_index" : "logstash-2015.07.08",
# "_type" : "logs",
# "_id" : "AU5vpr0F6gKLePtWPjrI",
# "_score" : 1.0,
# "_source":{"message":"teste 123 4","@version":"1","@timestamp":"
2015-07-08T21:51:15.204Z","host":"dba01"}
# }, {
# "_index" : "logstash-2015.07.08",
# "_type" : "logs",
# "_id" : "AU5vpqDe6gKLePtWPjrG",
# "_score" : 1.0,
# "_source":{"message":"","@version":"1","@timestamp":"2015-07-08T
21:51:07.436Z","host":"dba01"}
# } ]
# }
# }
./kibana-4.1.1-linux-x64/bin/kibana
firefox http://localhost:5601/
cd downloads
wget https://www.elastic.co/guide/en/kibana/3.0/snippets/shakespeare.jso
n
wget https://github.com/bly2k/files/blob/master/accounts.zip?raw=true
wget https://download.elastic.co/demos/kibana/gettingstarted/logs.jsonl.
gz
unzip accounts.zip
gunzip logs.jsonl.gz
curl -XPUT http://localhost:9200/shakespeare -d '
{
"mappings" : {
"_default_" : {
"properties" : {
"speaker" : {"type": "string", "index" : "not_analyzed" },
"play_name" : {"type": "string", "index" : "not_analyzed" },
"line_id" : { "type" : "integer" },
"speech_number" : { "type" : "integer" }
}
}
}
}
';
# {"acknowledged":true}
curl -XPOST 'localhost:9200/accounts/account/_bulk?pretty' --data-binary
@accounts.json
curl -XPOST 'localhost:9200/shakespeare/_bulk?pretty' --data-binary @sha
kespeare.json
curl -XPOST 'localhost:9200/_bulk?pretty' --data-binary @logs.jsonl
curl 'localhost:9200/_cat/indices?v'
LINKS
https://github.com/mbostock/d3/wiki/Gallery
https://www.elastic.co/guide/index.html
https://www.dashingd3js.com/basic-building-blocks
http://www.amazon.com/gp/product/B0028N4WJC/ref=as_li_qf
ie=UTF8&camp=1789&creative=9325&creativeASIN=B0028N4
20
http://www.visual-literacy.org/periodic_table/periodic_table.html
OBRIGADO!
@guediz
guedes(arroba)guedesoft.net
http://guedesoft.net

Weitere ähnliche Inhalte

Was ist angesagt?

Spatial script for Spatial mongo for PHP and Zend
Spatial script for Spatial mongo for PHP and ZendSpatial script for Spatial mongo for PHP and Zend
Spatial script for Spatial mongo for PHP and Zend
Steven Pousty
 
Accumulo Summit 2015: Zookeeper, Accumulo, and You [Internals]
Accumulo Summit 2015: Zookeeper, Accumulo, and You [Internals]Accumulo Summit 2015: Zookeeper, Accumulo, and You [Internals]
Accumulo Summit 2015: Zookeeper, Accumulo, and You [Internals]
Accumulo Summit
 
Centralized Logging with syslog
Centralized Logging with syslogCentralized Logging with syslog
Centralized Logging with syslog
amiable_indian
 
Instalasi Network Monitoring System (Nagios) Ubuntu 12.04
Instalasi Network Monitoring System (Nagios) Ubuntu 12.04Instalasi Network Monitoring System (Nagios) Ubuntu 12.04
Instalasi Network Monitoring System (Nagios) Ubuntu 12.04
Febi Gelar Ramadhan
 

Was ist angesagt? (20)

How to recognise that the user has just uninstalled your android app
How to recognise that the user has just uninstalled your android appHow to recognise that the user has just uninstalled your android app
How to recognise that the user has just uninstalled your android app
 
Webinar - Centralising syslogs with the new beats, logstash and elasticsearch
Webinar - Centralising syslogs with the new beats, logstash and elasticsearchWebinar - Centralising syslogs with the new beats, logstash and elasticsearch
Webinar - Centralising syslogs with the new beats, logstash and elasticsearch
 
Spark Day 2017- Spark 의 과거, 현재, 미래
Spark Day 2017- Spark 의 과거, 현재, 미래Spark Day 2017- Spark 의 과거, 현재, 미래
Spark Day 2017- Spark 의 과거, 현재, 미래
 
OpenStack Day 2 Operations
OpenStack Day 2 OperationsOpenStack Day 2 Operations
OpenStack Day 2 Operations
 
OpenStack Day 2 Operations (Toronto)
OpenStack Day 2 Operations (Toronto)OpenStack Day 2 Operations (Toronto)
OpenStack Day 2 Operations (Toronto)
 
Spatial script for Spatial mongo for PHP and Zend
Spatial script for Spatial mongo for PHP and ZendSpatial script for Spatial mongo for PHP and Zend
Spatial script for Spatial mongo for PHP and Zend
 
Coordination of Distributed Software with Redis
Coordination of Distributed Software with RedisCoordination of Distributed Software with Redis
Coordination of Distributed Software with Redis
 
Debugging: Rules & Tools
Debugging: Rules & ToolsDebugging: Rules & Tools
Debugging: Rules & Tools
 
Tests unitaires pour PostgreSQL avec pgTap
Tests unitaires pour PostgreSQL avec pgTapTests unitaires pour PostgreSQL avec pgTap
Tests unitaires pour PostgreSQL avec pgTap
 
Accumulo Summit 2015: Zookeeper, Accumulo, and You [Internals]
Accumulo Summit 2015: Zookeeper, Accumulo, and You [Internals]Accumulo Summit 2015: Zookeeper, Accumulo, and You [Internals]
Accumulo Summit 2015: Zookeeper, Accumulo, and You [Internals]
 
Intro django
Intro djangoIntro django
Intro django
 
Centralized Logging with syslog
Centralized Logging with syslogCentralized Logging with syslog
Centralized Logging with syslog
 
Ethical hacking with Python tools
Ethical hacking with Python toolsEthical hacking with Python tools
Ethical hacking with Python tools
 
Présentation Clever Audit
Présentation Clever AuditPrésentation Clever Audit
Présentation Clever Audit
 
Instalasi Network Monitoring System (Nagios) Ubuntu 12.04
Instalasi Network Monitoring System (Nagios) Ubuntu 12.04Instalasi Network Monitoring System (Nagios) Ubuntu 12.04
Instalasi Network Monitoring System (Nagios) Ubuntu 12.04
 
Linux audit framework
Linux audit frameworkLinux audit framework
Linux audit framework
 
Perl Sucks - and what to do about it
Perl Sucks - and what to do about itPerl Sucks - and what to do about it
Perl Sucks - and what to do about it
 
PuppetConf 2017: Use Puppet to Tame the Dockerfile Monster- Bryan Belanger, A...
PuppetConf 2017: Use Puppet to Tame the Dockerfile Monster- Bryan Belanger, A...PuppetConf 2017: Use Puppet to Tame the Dockerfile Monster- Bryan Belanger, A...
PuppetConf 2017: Use Puppet to Tame the Dockerfile Monster- Bryan Belanger, A...
 
Configuring Syslog by Octavio
Configuring Syslog by OctavioConfiguring Syslog by Octavio
Configuring Syslog by Octavio
 
Fileextraction with suricata
Fileextraction with suricataFileextraction with suricata
Fileextraction with suricata
 

Andere mochten auch

API Do Email Marketing Locaweb
API Do Email Marketing LocawebAPI Do Email Marketing Locaweb
API Do Email Marketing Locaweb
Locaweb
 

Andere mochten auch (20)

API Do Email Marketing Locaweb
API Do Email Marketing LocawebAPI Do Email Marketing Locaweb
API Do Email Marketing Locaweb
 
Dojo PHP (treinanto programação orientada a objetos em PHP)
Dojo PHP (treinanto programação orientada a objetos em PHP)Dojo PHP (treinanto programação orientada a objetos em PHP)
Dojo PHP (treinanto programação orientada a objetos em PHP)
 
Sistemas Distribuidos
Sistemas DistribuidosSistemas Distribuidos
Sistemas Distribuidos
 
Tech talkrubocop
Tech talkrubocopTech talkrubocop
Tech talkrubocop
 
Comercio eletronico - Dicas práticas
Comercio eletronico - Dicas práticasComercio eletronico - Dicas práticas
Comercio eletronico - Dicas práticas
 
Celery for SysAdmins
Celery for SysAdminsCelery for SysAdmins
Celery for SysAdmins
 
Debian no limite - como ter um desktop atualizado
Debian no limite - como ter um desktop atualizadoDebian no limite - como ter um desktop atualizado
Debian no limite - como ter um desktop atualizado
 
Se eu fosse a Microsoft
Se eu fosse a MicrosoftSe eu fosse a Microsoft
Se eu fosse a Microsoft
 
Postgres Wonderland - Campus Party 2013
Postgres Wonderland - Campus Party 2013Postgres Wonderland - Campus Party 2013
Postgres Wonderland - Campus Party 2013
 
Postgres Wonderland - PGDay CE2013
Postgres  Wonderland - PGDay CE2013Postgres  Wonderland - PGDay CE2013
Postgres Wonderland - PGDay CE2013
 
Isolamento e mvcc
Isolamento e mvccIsolamento e mvcc
Isolamento e mvcc
 
Overview Sobre Varnish
Overview Sobre VarnishOverview Sobre Varnish
Overview Sobre Varnish
 
Freenas
FreenasFreenas
Freenas
 
Postgres Big data
Postgres Big dataPostgres Big data
Postgres Big data
 
Soluções para sua empresa vender na Internet
Soluções para sua empresa vender na InternetSoluções para sua empresa vender na Internet
Soluções para sua empresa vender na Internet
 
Princípios de Concorrência em Ruby e Além
Princípios de Concorrência em Ruby e AlémPrincípios de Concorrência em Ruby e Além
Princípios de Concorrência em Ruby e Além
 
Storage em Oracle RAC
Storage em Oracle RACStorage em Oracle RAC
Storage em Oracle RAC
 
Estripando o Elefante - (Trabalhando com extensões no PostgreSQL)
Estripando o Elefante - (Trabalhando com extensões no PostgreSQL)Estripando o Elefante - (Trabalhando com extensões no PostgreSQL)
Estripando o Elefante - (Trabalhando com extensões no PostgreSQL)
 
Trabalhando com Logs no PostgreSQL
Trabalhando com Logs no PostgreSQLTrabalhando com Logs no PostgreSQL
Trabalhando com Logs no PostgreSQL
 
Revisão do postgresql.conf
Revisão do postgresql.confRevisão do postgresql.conf
Revisão do postgresql.conf
 

Ähnlich wie Como encontrar uma agulha num palheiro de logs

Gazelle - Plack Handler for performance freaks #yokohamapm
Gazelle - Plack Handler for performance freaks #yokohamapmGazelle - Plack Handler for performance freaks #yokohamapm
Gazelle - Plack Handler for performance freaks #yokohamapm
Masahiro Nagano
 
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
Wesley Beary
 
Smolder @Silex
Smolder @SilexSmolder @Silex
Smolder @Silex
Jeen Lee
 

Ähnlich wie Como encontrar uma agulha num palheiro de logs (20)

Logstash
LogstashLogstash
Logstash
 
Oracle on AWS RDS Migration - 성기명
Oracle on AWS RDS Migration - 성기명Oracle on AWS RDS Migration - 성기명
Oracle on AWS RDS Migration - 성기명
 
Elasticsearch sur Azure : Make sense of your (BIG) data !
Elasticsearch sur Azure : Make sense of your (BIG) data !Elasticsearch sur Azure : Make sense of your (BIG) data !
Elasticsearch sur Azure : Make sense of your (BIG) data !
 
Why you should be using structured logs
Why you should be using structured logsWhy you should be using structured logs
Why you should be using structured logs
 
Osol Pgsql
Osol PgsqlOsol Pgsql
Osol Pgsql
 
Docker Logging and analysing with Elastic Stack - Jakub Hajek
Docker Logging and analysing with Elastic Stack - Jakub Hajek Docker Logging and analysing with Elastic Stack - Jakub Hajek
Docker Logging and analysing with Elastic Stack - Jakub Hajek
 
Docker Logging and analysing with Elastic Stack
Docker Logging and analysing with Elastic StackDocker Logging and analysing with Elastic Stack
Docker Logging and analysing with Elastic Stack
 
Gazelle - Plack Handler for performance freaks #yokohamapm
Gazelle - Plack Handler for performance freaks #yokohamapmGazelle - Plack Handler for performance freaks #yokohamapm
Gazelle - Plack Handler for performance freaks #yokohamapm
 
MySQL Tuning using digested slow-logs
MySQL Tuning using digested slow-logsMySQL Tuning using digested slow-logs
MySQL Tuning using digested slow-logs
 
SDPHP - Percona Toolkit (It's Basically Magic)
SDPHP - Percona Toolkit (It's Basically Magic)SDPHP - Percona Toolkit (It's Basically Magic)
SDPHP - Percona Toolkit (It's Basically Magic)
 
Application Logging in the 21st century - 2014.key
Application Logging in the 21st century - 2014.keyApplication Logging in the 21st century - 2014.key
Application Logging in the 21st century - 2014.key
 
ELK stack at weibo.com
ELK stack at weibo.comELK stack at weibo.com
ELK stack at weibo.com
 
Simple Spring Memcached
Simple Spring MemcachedSimple Spring Memcached
Simple Spring Memcached
 
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
 
Passbolt Introduction and Usage for secret managment
Passbolt Introduction and Usage for secret managmentPassbolt Introduction and Usage for secret managment
Passbolt Introduction and Usage for secret managment
 
Smolder @Silex
Smolder @SilexSmolder @Silex
Smolder @Silex
 
fog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the Cloudfog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the Cloud
 
Pdxpugday2010 pg90
Pdxpugday2010 pg90Pdxpugday2010 pg90
Pdxpugday2010 pg90
 
Dave Williams - Nagios Log Server - Practical Experience
Dave Williams - Nagios Log Server - Practical ExperienceDave Williams - Nagios Log Server - Practical Experience
Dave Williams - Nagios Log Server - Practical Experience
 
Workshop quality assurance for php projects - phpbelfast
Workshop quality assurance for php projects - phpbelfastWorkshop quality assurance for php projects - phpbelfast
Workshop quality assurance for php projects - phpbelfast
 

Mehr von Dickson S. Guedes

Conhecendo Postgresql.- ENECOMP 2009
Conhecendo Postgresql.- ENECOMP 2009Conhecendo Postgresql.- ENECOMP 2009
Conhecendo Postgresql.- ENECOMP 2009
Dickson S. Guedes
 
Minicurso Postgresql - Enecomp 2009
Minicurso Postgresql - Enecomp 2009Minicurso Postgresql - Enecomp 2009
Minicurso Postgresql - Enecomp 2009
Dickson S. Guedes
 

Mehr von Dickson S. Guedes (20)

Ganhando tempo automatizando com SQL
Ganhando tempo automatizando com SQLGanhando tempo automatizando com SQL
Ganhando tempo automatizando com SQL
 
O mínimo necessário que você precisa conhecer sobre computação quântica
O mínimo necessário que você precisa conhecer sobre computação quânticaO mínimo necessário que você precisa conhecer sobre computação quântica
O mínimo necessário que você precisa conhecer sobre computação quântica
 
Porque aprender várias linguagens me tornou um DBA (e desenvolvedor) melhor
Porque aprender várias linguagens me tornou um DBA (e desenvolvedor) melhorPorque aprender várias linguagens me tornou um DBA (e desenvolvedor) melhor
Porque aprender várias linguagens me tornou um DBA (e desenvolvedor) melhor
 
Pattern matching - O que é? Onde vive? Do que se alimenta? Como se reproduz?
Pattern matching - O que é? Onde vive? Do que se alimenta? Como se reproduz?Pattern matching - O que é? Onde vive? Do que se alimenta? Como se reproduz?
Pattern matching - O que é? Onde vive? Do que se alimenta? Como se reproduz?
 
Primeiros passos machine learning PostgreSQL
Primeiros passos machine learning PostgreSQLPrimeiros passos machine learning PostgreSQL
Primeiros passos machine learning PostgreSQL
 
Dicas de sobrevivência de um DBA sem mouse
Dicas de sobrevivência de um DBA sem mouseDicas de sobrevivência de um DBA sem mouse
Dicas de sobrevivência de um DBA sem mouse
 
Destistificando o EXPLAIN
Destistificando o EXPLAIN Destistificando o EXPLAIN
Destistificando o EXPLAIN
 
Falando "Postgrês"
Falando "Postgrês"Falando "Postgrês"
Falando "Postgrês"
 
Se meu elefante falasse
Se meu elefante falasseSe meu elefante falasse
Se meu elefante falasse
 
Curiosidades que você (talvez) não sabia e se sabia vale a pena lembrar
Curiosidades que você (talvez) não sabia e se sabia vale a pena lembrarCuriosidades que você (talvez) não sabia e se sabia vale a pena lembrar
Curiosidades que você (talvez) não sabia e se sabia vale a pena lembrar
 
O Elefante Poliglota
O Elefante PoliglotaO Elefante Poliglota
O Elefante Poliglota
 
Como encontrar uma agulha no palheiro de logs do PostgreSQL
Como encontrar uma agulha no palheiro de logs do PostgreSQLComo encontrar uma agulha no palheiro de logs do PostgreSQL
Como encontrar uma agulha no palheiro de logs do PostgreSQL
 
Gerenciando múltiplas versões do PostgreSQL com pgvm
Gerenciando múltiplas versões do PostgreSQL com pgvmGerenciando múltiplas versões do PostgreSQL com pgvm
Gerenciando múltiplas versões do PostgreSQL com pgvm
 
PGXN - Como distribuir suas extensões com o PostgreSQL
PGXN - Como distribuir suas extensões com o PostgreSQLPGXN - Como distribuir suas extensões com o PostgreSQL
PGXN - Como distribuir suas extensões com o PostgreSQL
 
Pgxn.pgday
Pgxn.pgdayPgxn.pgday
Pgxn.pgday
 
Plante uma árvore, escreva um livro, tenha um filho e contribua com software ...
Plante uma árvore, escreva um livro, tenha um filho e contribua com software ...Plante uma árvore, escreva um livro, tenha um filho e contribua com software ...
Plante uma árvore, escreva um livro, tenha um filho e contribua com software ...
 
Conhecendo Postgresql.- ENECOMP 2009
Conhecendo Postgresql.- ENECOMP 2009Conhecendo Postgresql.- ENECOMP 2009
Conhecendo Postgresql.- ENECOMP 2009
 
Minicurso Postgresql - Enecomp 2009
Minicurso Postgresql - Enecomp 2009Minicurso Postgresql - Enecomp 2009
Minicurso Postgresql - Enecomp 2009
 
Testes unitarios no PostgreSQL com pgTAP
Testes unitarios no PostgreSQL com pgTAPTestes unitarios no PostgreSQL com pgTAP
Testes unitarios no PostgreSQL com pgTAP
 
pgScript: um Elefante de barriga cheia
pgScript: um Elefante de barriga cheiapgScript: um Elefante de barriga cheia
pgScript: um Elefante de barriga cheia
 

Kürzlich hochgeladen

introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 

Kürzlich hochgeladen (20)

Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 

Como encontrar uma agulha num palheiro de logs

  • 1. COMO ENCONTRAR UMA AGULHA NUM PALHEIRO DE LOGS DICKSON S. GUEDES @GUEDIZ FISL16 (2015) - PORTO ALEGRE, RS
  • 2. UMA ANALOGIA SOBRE AGULHA E O PALHEIRO
  • 3. QUE FERRAMENTAS PERMITIRIAM ENCONTRAR AGULHAS EM UM PALHEIRO?
  • 4. QUE CARACTERÍSTICAS A AGULHA DEVE POSSUIR PARA SER ENCONTRADA?
  • 5. UM REGISTRO ESPECIFICO DE LOG SERIA NOSSA AGULHA
  • 6. TODOS OS DEMAIS REGISTROS SERIAM NOSSO PALHEIRO
  • 8. MAIS DO QUE ISSO, O LOG É UMA INTERFACE DE USUÁRIO
  • 9. quando? quem? onde? como? o quê? QUE CARACTERÍSTICAS UM LOG PRECISA TER PARA SER ENCONTRADO?
  • 11. bash, grep, awk, sed, ruby, python, perl … syslog Usar uma pilha pronta como a ELK: Montar sua própria pilha QUEM SERIA NOSSO IMÃ? Elasticsearch Logstash Kibana PostgreSQL Hadoop Flume Fluentd GNUplot D3.js
  • 12. e podem nos ajudar a enxergar melhor … apresentar CSS e HTML e imagens é o mínimo que se espera manipulação da DOM manipulação de imagens SVG "OS NAVEGADORES ESTÃO MAIS MODERNOS"
  • 13. NOSSO EXEMPLO DE HOJE Logstash Elasticsearch Kibana D3.js
  • 14. pipeline input | filter | output file | grep | csv twitter | grep | json imap | ruby | xmpp file | grok | elasticsearch LOGSTASH
  • 15. banco de dados não relacional indices documentos fields full text search ELASTICSEARCH
  • 18. SHOW ME THE CODE! cd $work mkdir downloads cd downloads wget https://download.elastic.co/elasticsearch/elasticsearch/elasticsear ch-1.6.0.tar.gz wget https://download.elastic.co/logstash/logstash/logstash-1.5.2.tar.gz wget https://download.elastic.co/kibana/kibana/kibana-4.1.1-linux-x64.ta r.gz cd .. tar zxvf download/elasticsearch-1.6.0.tar.gz tar zxvf download/kibana-4.1.1-linux-x64.tar.gz tar zxvf download/logstash-1.5.2.tar.gz ./elasticsearch-1.6.0/bin/elasticsearch curl -X GET http://localhost:9200 # { # "status" : 200, # "name" : "Kick-Ass", # "cluster_name" : "elasticsearch", # "version" : { # "number" : "1.6.0", # "build_hash" : "cdd3ac4dde4f69524ec0a14de3828cb95bbb86d0", # "build_timestamp" : "2015-06-09T13:36:34Z", # "build_snapshot" : false, # "lucene_version" : "4.10.4" # }, # "tagline" : "You Know, for Search" # } ./logstash-1.5.2/bin/logstash -e 'input { stdin { } } output { stdout {
  • 19. } }' # Logstash startup completed teste # 2015-07-08T21:42:43.129Z dba01 teste ola mundo # 2015-07-08T21:42:47.899Z dba01 ola mundo ^C # SIGINT received. Shutting down the pipeline. {:level=>:warn} # Logstash shutdown completed ./logstash-1.5.2/bin/logstash -e 'input { stdin { } } output { stdout { codec => rubydebug } }' # Logstash startup completed ola mundo! # { # "message" => "ola mundo!", # "@version" => "1", # "@timestamp" => "2015-07-08T21:44:00.804Z", # "host" => "dba01" # } teste # { # "message" => "teste", # "@version" => "1", # "@timestamp" => "2015-07-08T21:45:00.075Z", # "host" => "dba01" # } ./logstash-1.5.2/bin/logstash -e 'input { stdin { } } output { elasticse arch { } }' # Jul 08, 2015 6:48:49 PM org.elasticsearch.node.internal.InternalNode < init> # INFORMAÇÕES: [logstash-dba01-8559-11620] version[1.5.1], pid[8559], bu ild[5e38401/2015-04-09T13:4 # 1:35Z] # Jul 08, 2015 6:48:49 PM org.elasticsearch.node.internal.InternalNode < init>
  • 20. # INFORMAÇÕES: [logstash-dba01-8559-11620] initializing ... # Jul 08, 2015 6:48:49 PM org.elasticsearch.plugins.PluginsService <init > # INFORMAÇÕES: [logstash-dba01-8559-11620] loaded [], sites [] # Jul 08, 2015 6:48:50 PM org.elasticsearch.node.internal.InternalNode < init> # INFORMAÇÕES: [logstash-dba01-8559-11620] initialized # Jul 08, 2015 6:48:50 PM org.elasticsearch.node.internal.InternalNode s tart # INFORMAÇÕES: [logstash-dba01-8559-11620] starting ... # Jul 08, 2015 6:48:50 PM org.elasticsearch.transport.TransportService d oStart # INFORMAÇÕES: [logstash-dba01-8559-11620] bound_address {inet[/0:0:0:0: 0:0:0:0:9301]}, publish_add # ress {inet[/10.1.6.88:9301]} # Jul 08, 2015 6:48:50 PM org.elasticsearch.discovery.DiscoveryService d oStart # INFORMAÇÕES: [logstash-dba01-8559-11620] elasticsearch/4htwknhiS2S9swI vVsWTxQ # Jul 08, 2015 6:48:53 PM org.elasticsearch.cluster.service.InternalClus terService$UpdateTask run # INFORMAÇÕES: [logstash-dba01-8559-11620] detected_master [Kick-Ass][-e atoEY8TWecIb34yKjM8w][dba01 # ][inet[/10.1.6.88:9300]], added {[Kick-Ass][-eatoEY8TWecIb34yKjM8w][db a01][inet[/10.1.6.88:9300]] # ,}, reason: zen-disco-receive(from master [[Kick-Ass][-eatoEY8TWecIb34 yKjM8w][dba01][inet[/10.1.6 # .88:9300]]]) # Jul 08, 2015 6:48:53 PM org.elasticsearch.node.internal.InternalNode s tart # INFORMAÇÕES: [logstash-dba01-8559-11620] started # Logstash startup completed # no elasticsearch # [2015-07-08 18:48:53,736][INFO ][cluster.service ] [Kick-Ass] added # {[logstash-dba01-8559-11620][4htwknhiS2S9swIvVsWTxQ][dba01][inet[/10.1
  • 21. .6.88:9301]]{client=true, # data=false},}, reason: zen-disco-receive(join from # node[[logstash-dba01-8559-11620][4htwknhiS2S9swIvVsWTxQ][dba01][inet[/ 10.1.6.88:9301]]{client=true, # data=false}]) # no logstash teste 123 teste 123 4 # em outro shell curl 'http://localhost:9200/_search?pretty' # { # "took" : 1, # "timed_out" : false, # "_shards" : { # "total" : 5, # "successful" : 5, # "failed" : 0 # }, # "hits" : { # "total" : 3, # "max_score" : 1.0, # "hits" : [ { # "_index" : "logstash-2015.07.08", # "_type" : "logs", # "_id" : "AU5vpqcN6gKLePtWPjrH", # "_score" : 1.0, # "_source":{"message":"teste 123","@version":"1","@timestamp":"20 15-07-08T21:51:09.580Z","host":"dba01"} # }, { # "_index" : "logstash-2015.07.08", # "_type" : "logs", # "_id" : "AU5vpr0F6gKLePtWPjrI", # "_score" : 1.0, # "_source":{"message":"teste 123 4","@version":"1","@timestamp":"
  • 22. 2015-07-08T21:51:15.204Z","host":"dba01"} # }, { # "_index" : "logstash-2015.07.08", # "_type" : "logs", # "_id" : "AU5vpqDe6gKLePtWPjrG", # "_score" : 1.0, # "_source":{"message":"","@version":"1","@timestamp":"2015-07-08T 21:51:07.436Z","host":"dba01"} # } ] # } # } ./kibana-4.1.1-linux-x64/bin/kibana firefox http://localhost:5601/ cd downloads wget https://www.elastic.co/guide/en/kibana/3.0/snippets/shakespeare.jso n wget https://github.com/bly2k/files/blob/master/accounts.zip?raw=true wget https://download.elastic.co/demos/kibana/gettingstarted/logs.jsonl. gz unzip accounts.zip gunzip logs.jsonl.gz curl -XPUT http://localhost:9200/shakespeare -d ' { "mappings" : { "_default_" : { "properties" : { "speaker" : {"type": "string", "index" : "not_analyzed" }, "play_name" : {"type": "string", "index" : "not_analyzed" }, "line_id" : { "type" : "integer" }, "speech_number" : { "type" : "integer" } } }
  • 23. } } '; # {"acknowledged":true} curl -XPOST 'localhost:9200/accounts/account/_bulk?pretty' --data-binary @accounts.json curl -XPOST 'localhost:9200/shakespeare/_bulk?pretty' --data-binary @sha kespeare.json curl -XPOST 'localhost:9200/_bulk?pretty' --data-binary @logs.jsonl curl 'localhost:9200/_cat/indices?v'