COMO ENCONTRAR UMA
AGULHA NO PALHEIRO DE
LOGS DO POSTGRESQL
DICKSON S. GUEDES
,PGBR2013 - PORTO VELHO RO
VAMOS VER COMO TRANFORMAR ISTO…
2013-07-02 14:32:47.756 -0300,"postgres","postgres",6817,"[local]",51d30
ebe.1aa1,3,"idle",2013-07-02 14:32:46 BRT,,0,LOG,00000,"disconnection: s
ession time: 0:00:01.258 user=postgres database=postgres host=[local]",,
,,,,,,,"psql"
2013-07-02 14:32:51.901 -0300,"sistema","banco",5263,"10.1.3.15:38337",5
1d2f128.148f,1,"SELECT",2013-07-02 12:26:32 BRT,53/1448601,0,LOG,00000,"
duration: 4445.476 ms execute <unnamed>: select l.cod_xpto, null, l.cod_
pre_xpto, l.cod_oper_xpto, l.dt_xpto, l.valor_xpto, null, c.cod_xpto, c.
dv_cod_xpto, c.descricao, l.tipo from xpto l join plxpto p on (l.seq_xpt
o = p.seq_xpto) join coxpto c on (p.xpto = c.seq_xpto) where c.cod_xpto
= $1 and l.dt_xpto between $2 and $3 and l.cod_xpto = $4 and l.situacao
IN ($5, $6, $7) union select d.cod_xpto, d.cod_de, d.cod_pre_xpto, l.cod
_o_xpto, l.dt_xpto, null, d.valor_de, c.cod_xpto, c.dv_cod_xpto, c.descr
icao,d.operacao from desdxpto d join xpto l on (d.cod_xpto = l.cod_xpto
and d.cod_xpto= l.cod_xpto) join plxpto p on (d.seq_xpto = p.seq_xpto) j
oin coxpto c on (p.xpto = c.seq_xpto) where c.cod_xpto = $8 and l.dt_xpt
o between $9 and $10 and l.cod_xpto = $11 and l.situacao IN ($12, $13, $
14) ","xpto: $1 = '1001001', $2 = '2013-05-01', $3 = '2013-06-25', $4 =
'201', $5 = '287', $6 = '88', $7 = '200', $8 = '111001001', $9 = '2013-0
5-01', $10 = '2013-06-25', $11 = '13', $12 = '287', $13 = '208', $14 = '
29'",,,,,,,,""
NISTO…
VAMOS FALAR SOBRE REGISTRO DE EVENTOS E
POSTGRES
REGISTRO DE EVENTOS TAMBÉM É CONHECIDO
COMO: LOG
QUAIS AS PEÇAS QUE COMPOEM UM EVENTO?
Quando?
Quem?
Onde?
O quê?
Como? [debug]
VAMOS A UM EXERCÍCIO …
ISTO PARA VOCÊ É SUFICIENTE?
caiu
subiu
estabilizou
E SE ADICIONARMOS MAIS UM DADO?
a temperatura caiu
a temperatura subiu
a temperatura estabilizou
E MAIS UM …
em SP a temperatura caiu
em CE a temperatura subiu
em RJ a temperatura estabilizou
E PARA FINALIZAR …
ontem em SP a temperatura caiu
hoje em CE a temperatura subiu
semana passada em RJ a temperatura estabilizou
E SE OLHARMOS PARA ISTO?
REGISTRAR É IMPORTANTE!
MAS O QUÊ É IMPORTANTE SER REGISTRADO?
PRÁTICA: LOG DO POSTGRES
PRÁTICA: LOGSTASH
ENTRADA > PROCESSAMENTO > SAIDA
INPUT > FILTER > OUTPUT
LINKS
http://logstash.net/docs/1.1.13/
pagina de panico
DEMONSTRANDO TUDO…
QUESTÕES?
email/gtalk: guedes@guedesoft.net
twitter: @guediz
youtube: guediz
github: guedes
http://guedesoft.net
http://www.timbira.com.br

Como encontrar uma agulha no palheiro de logs do PostgreSQL

  • 1.
    COMO ENCONTRAR UMA AGULHANO PALHEIRO DE LOGS DO POSTGRESQL DICKSON S. GUEDES ,PGBR2013 - PORTO VELHO RO
  • 2.
    VAMOS VER COMOTRANFORMAR ISTO… 2013-07-02 14:32:47.756 -0300,"postgres","postgres",6817,"[local]",51d30 ebe.1aa1,3,"idle",2013-07-02 14:32:46 BRT,,0,LOG,00000,"disconnection: s ession time: 0:00:01.258 user=postgres database=postgres host=[local]",, ,,,,,,,"psql" 2013-07-02 14:32:51.901 -0300,"sistema","banco",5263,"10.1.3.15:38337",5 1d2f128.148f,1,"SELECT",2013-07-02 12:26:32 BRT,53/1448601,0,LOG,00000," duration: 4445.476 ms execute <unnamed>: select l.cod_xpto, null, l.cod_ pre_xpto, l.cod_oper_xpto, l.dt_xpto, l.valor_xpto, null, c.cod_xpto, c. dv_cod_xpto, c.descricao, l.tipo from xpto l join plxpto p on (l.seq_xpt o = p.seq_xpto) join coxpto c on (p.xpto = c.seq_xpto) where c.cod_xpto = $1 and l.dt_xpto between $2 and $3 and l.cod_xpto = $4 and l.situacao IN ($5, $6, $7) union select d.cod_xpto, d.cod_de, d.cod_pre_xpto, l.cod _o_xpto, l.dt_xpto, null, d.valor_de, c.cod_xpto, c.dv_cod_xpto, c.descr icao,d.operacao from desdxpto d join xpto l on (d.cod_xpto = l.cod_xpto and d.cod_xpto= l.cod_xpto) join plxpto p on (d.seq_xpto = p.seq_xpto) j oin coxpto c on (p.xpto = c.seq_xpto) where c.cod_xpto = $8 and l.dt_xpt o between $9 and $10 and l.cod_xpto = $11 and l.situacao IN ($12, $13, $ 14) ","xpto: $1 = '1001001', $2 = '2013-05-01', $3 = '2013-06-25', $4 = '201', $5 = '287', $6 = '88', $7 = '200', $8 = '111001001', $9 = '2013-0 5-01', $10 = '2013-06-25', $11 = '13', $12 = '287', $13 = '208', $14 = ' 29'",,,,,,,,""
  • 3.
  • 4.
    VAMOS FALAR SOBREREGISTRO DE EVENTOS E POSTGRES
  • 5.
    REGISTRO DE EVENTOSTAMBÉM É CONHECIDO COMO: LOG
  • 6.
    QUAIS AS PEÇASQUE COMPOEM UM EVENTO? Quando? Quem? Onde? O quê? Como? [debug]
  • 7.
    VAMOS A UMEXERCÍCIO …
  • 8.
    ISTO PARA VOCÊÉ SUFICIENTE? caiu subiu estabilizou
  • 9.
    E SE ADICIONARMOSMAIS UM DADO? a temperatura caiu a temperatura subiu a temperatura estabilizou
  • 10.
    E MAIS UM… em SP a temperatura caiu em CE a temperatura subiu em RJ a temperatura estabilizou
  • 11.
    E PARA FINALIZAR… ontem em SP a temperatura caiu hoje em CE a temperatura subiu semana passada em RJ a temperatura estabilizou
  • 12.
    E SE OLHARMOSPARA ISTO?
  • 13.
  • 14.
    MAS O QUÊÉ IMPORTANTE SER REGISTRADO?
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
    QUESTÕES? email/gtalk: guedes@guedesoft.net twitter: @guediz youtube:guediz github: guedes http://guedesoft.net http://www.timbira.com.br