Logs, pra que te quero!
PHP Community Summit by locaweb
> whoiam
• Desenvolvedor Backend @
Leroy Merlin
• Instrutor @ Treinaweb
• Zend Certified PHP Engineer
• MCSA SQL Server
(2012/2014/2016)
PHP Community Summit by locaweb
Tópicos
• O que são logs?
• Características de um bom log
• Níveis de Criticidade
• PSR-3
• Monolog
• Analise de logs
• Serviços externos
PHP Community Summit by locaweb
O que são Logs?
• “Quando o homem avançou o mar, na época dos grandes
descobrimentos, para deixar registrado os eventos ocorridos
durante a viagem foi comum a criação de um log, no sentido
de ser um 'diário de bordo'.” - Wikipedia
PHP Community Summit by locaweb
O que são Logs?
PHP Community Summit by locaweb
O que são Logs?
PHP Community Summit by locaweb
O que são Logs?
PHP Community Summit by locaweb
O que são Logs?
PHP Community Summit by locaweb
Características de um bom log
Logs, pra que te quero!
PHP Community Summit by locaweb
Ser claro e informativo
// mensagens que não dizem nada
[2017-07-20 02:41:11] INFO: foi
[2017-07-20 02:41:11] DEBUG: vai
[2017-07-20 02:41:11] NOTICE: passou!!
[2017-07-20 02:41:11] DEBUG: 2
[2017-07-20 02:41:11] DEBUG: 3
[2017-07-20 02:41:11] DEBUG: 4
// sem detalhes do evento
[2017-07-20 02:41:11] WARNING: Unable to sync Sale Order
PHP Community Summit by locaweb
Ter contexto
// Explicar o que está acontecendo
[2017-07-20 02:48:25] INFO: Starting csv file import {"file":"/path/file.csv"} []
[2017-07-20 02:48:25] DEBUG: Reading csv file [] []
[2017-07-20 02:48:25] NOTICE: Skip header {"line":1} []
[2017-07-20 02:48:25] DEBUG: Loading row 2 {"line":2,"data":{"some":"data"}} []
[2017-07-20 02:48:25] DEBUG: Loading row 3 {"line":3,"data":{"some":"data"}} []
[2017-07-20 02:48:25] DEBUG: Loading row 4 {"line":4,"data":{"some":"data"}} []
// Incluir informações sobre o contexto
[2017-07-20 02:48:25] WARNING: Unable to sync Sale Order {"id":123}
{"file":"/mnt/c/Users/gabri/Projects/tdc/good-
logs.php","line":32,"class":null,"function":null}
PHP Community Summit by locaweb
Fácil de pesquisar e agrupar
// Repensar logs com mensagem dinâmica
ERROR: Allowed memory size of 5202142 bytes exhausted (tried to allocate 370697 bytes)
ERROR: Allowed memory size of 2916448 bytes exhausted (tried to allocate 251567 bytes)
ERROR: Allowed memory size of 4127488 bytes exhausted (tried to allocate 895479 bytes)
// Incluir tags
INFO: Starting csv file import {"file":"/path/file.csv"} {"tags":["integration","product"]}
NOTICE: Skip header {"line":1} {"tags":["integration","product"]}
DEBUG: Loading row 2 {"line":2,"data":{"some":"data"}} {"tags":["integration","product"]}
DEBUG: Loading row 3 {"line":3,"data":{"some":"data"}} {"tags":["integration","product"]}
DEBUG: Loading row 4 {"line":4,"data":{"some":"data"}} {"tags":["integration","product"]}
PHP Community Summit by locaweb
Utilizar níveis de criticidade
PHP Community Summit by locaweb
Analise seus logs
• Antecipe problemas analisando seus logs
• Tenha rotinas para ver logs não críticos
• Não use seus logs só para apagar incêndios
PHP Community Summit by locaweb
Níveis de Criticidade
Logs, pra que te quero!
PHP Community Summit by locaweb
Níveis de Criticidade
0
1
2
3
4
5
6
7
8
Level
• Debug
Contém informações detalhadas para debug
Geralmente é desligado em produção
(Ex: Iterações de um loop, query SQL gerada pelo ORM)
PHP Community Summit by locaweb
Níveis de Criticidade
0
1
2
3
4
5
6
7
8
Level
• Info
Eventos comuns ocorridos no sistema
(Ex.: Usuário fez login, hits na API)
PHP Community Summit by locaweb
Níveis de Criticidade
0
1
2
3
4
5
6
7
8
Level
• Notice
Eventos comuns, porém com certa relevância no sistema
PHP Community Summit by locaweb
Níveis de Criticidade
0
1
2
3
4
5
6
7
8
Level
• Warning
Eventos não caracterizados como erro, mas que merecem
uma certa atenção
(Ex.: Uso de funções descontinuadas)
PHP Community Summit by locaweb
Níveis de Criticidade
0
1
2
3
4
5
6
7
8
Level
• Error
Erros encontrados em tempo de execução
Exceptions não tratadas aparecem aqui
PHP Community Summit by locaweb
Níveis de Criticidade
0
1
2
3
4
5
6
7
8
Level
• Critical
Condições críticas no sistema, como falha de serviços
externos
Pode ser usado para medir nível de serviço (SLA)
PHP Community Summit by locaweb
Níveis de Criticidade
0
1
2
3
4
5
6
7
8
Level
• Alert
Requer uma ação corretiva imediata
Aqui alguém vai te ligar, enviar SMS, @channel no Slack,
sinal de fumaça
PHP Community Summit by locaweb
Níveis de Criticidade
0
1
2
3
4
5
6
7
8
Level
• Emergency
Sistema está em um estado não utilizável
É raro no nível da aplicação
PHP Community Summit by locaweb
E no PHP, como faz?
Logs, pra que te quero!
PHP Community Summit by locaweb
PSR-3
• Padrão de Logs para PHP
• De acordo com os níveis de criticidade da IETF RFC 5424
• Algumas implementações: monolog, zend-log, log4php
Especificação da PSR-3
PHP Community Summit by locaweb
Monolog
• Handlers
• Destino do log
• Formatters
• Formato em que o log será enviado
• Processors
• Informações extras para o log
PHP Community Summit by locaweb
Handlers
• StreamHandler
• RotatingFileHandler
• SlackWebhookHandler
• MandrillHandler
• NewRelicHandler
• LogEntriesHandler
• NullHandler
PHP Community Summit by locaweb
Formatters
• LineFormatter
• HtmlFormatter
• JsonFormatter
• ChromePHPFormatter
• LogstashFormatter
PHP Community Summit by locaweb
Processors
• PsrLogMessageProcessor
• IntrospectionProcessor
• WebProcessor
• MemoryPeakUsageProcessor
• GitProcessor
• TagProcessor
PHP Community Summit by locaweb
Exemplos
<?php
require_once __DIR__ . '/vendor/autoload.php';
use MonologHandlerStreamHandler;
use MonologLogger;
$logger = new Logger('my_logger');
$logger->pushHandler(new StreamHandler(__DIR__.'/my_app.log'));
$logger->info('Hello World!');
// my_app.log:
[2017-07-20 00:51:27] my_logger.INFO: Hello World! [] []
PHP Community Summit by locaweb
Exemplos
use MonologHandlerRotatingFileHandler;
$logger->pushHandler(new RotatingFileHandler(__DIR__.'/error.log', 3, Logger::ERROR));
$logger->debug('Debug event');
$logger->error('Error event');
// my_app.log:
[2017-07-20 01:10:21] my_logger.DEBUG: Debug event [] []
[2017-07-20 01:10:21] my_logger.ERROR: Error event [] []
// error-2017-07-20.log
[2017-07-20 01:10:22] my_logger.ERROR: Error event [] []
PHP Community Summit by locaweb
Exemplos
use MonologProcessorIntrospectionProcessor;
$logger->pushProcessor(new IntrospectionProcessor(Logger::WARNING));
$logger->notice('Important event');
$logger->warning('Deprecated: Lorem Ipsum...');
// my_app.log:
[2017-07-20 01:25:02] my_logger.NOTICE: Important event [] []
[2017-07-20 01:26:03] my_logger.WARNING: Deprecated: Lorem Ipsum... []
{"file":"/mnt/c/Users/gabri/Projects/tdc/bootstrap.php","line":21,"class":null,"function":n
ull}
PHP Community Summit by locaweb
Exemplos
$data = ['user' => 'TDC'];
$logger->info('User '. $data['user'] .' logged', $data); // without Psr Processor
use MonologProcessorPsrLogMessageProcessor;
$logger->info('User {user} logged', $data); // with Psr Processor
// my_app.log:
[2017-07-20 01:25:02] my_logger.INFO: User TDC logged {"user":"TDC"} []
[2017-07-20 01:25:02] my_logger.INFO: User TDC logged {"user":"TDC"} []
PHP Community Summit by locaweb
Exemplos
$rotatingFileHandler = $logger->popHandler();
$fileHandler = $logger->popHandler();
$htmlHandler = new StreamHandler(__DIR__.'/log.html', Logger::DEBUG);
use MonologFormatterLineFormatter; use MonologFormatterJsonFormatter;
use MonologFormatterHtmlFormatter;
$fileHandler->setFormatter(new LineFormatter("%level_name%: %message% %context% %extra%n"));
$rotatingFileHandler->setFormatter(new JsonFormatter());
$htmlHandler->setFormatter(new HtmlFormatter());
$logger->setHandlers([$fileHandler, $rotatingFileHandler, $htmlHandler]);
$logger->error('Unhandled Expection: Lorem ipsum', ['user' => 'locaweb']);
$logger->critical('User {user} is trying to hack us!', ['id' => 666, 'user' => 'locaweb',]);
PHP Community Summit by locaweb
Exemplos
// my_app.log
[2017-07-20 02:00:18] my_logger.INFO: User locaweb logged {"user":"locaweb "} []
ERROR: Unhandled Expection: Lorem ipsum {"user":"locaweb"}
{"file":"/mnt/c/Users/gabri/Projects/tdc/bootstrap.php","line":51,"class":null,"function":n
ull}
CRITICAL: User locaweb is trying to hack us! {"id":666,"user":"locaweb "}
{"file":"/mnt/c/Users/gabri/Projects/tdc/bootstrap.php","line":52,"class":null,"function":n
ull}
PHP Community Summit by locaweb
Exemplos
// error-2017-07-20.log
[2017-07-20 02:00:18] my_logger.ERROR: Error event [] []
{"message":"Unhandled Expection: Lorem
ipsum","context":{"user":"locaweb"},"level":400,"level_name":"ERROR","channel":"my_logger",
"datetime":{"date":"2017-07-20
02:00:18.608935","timezone_type":3,"timezone":"UTC"},"extra":{"file":"/mnt/c/Users/gabri/Pr
ojects/tdc/bootstrap.php","line":51,"class":null,"function":null}}
{"message":"User locaweb is trying to hack
us!","context":{"id":666,"user":"locaweb"},"level":500,"level_name":"CRITICAL","channel":"m
y_logger","datetime":{"date":"2017-07-20
02:00:18.610325","timezone_type":3,"timezone":"UTC"},"extra":{"file":"/mnt/c/Users/gabri/Pr
ojects/tdc/bootstrap.php","line":52,"class":null,"function":null}}
PHP Community Summit by locaweb
Exemplos
PHP Community Summit by locaweb
Como usar no seu projeto?
Logs, pra que te quero!
PHP Community Summit by locaweb
Projetos com suporte Monolog
• Symfony
• Laravel
• Zend Framework *
• Drupal *
• Magento
• Expressive *
• Silex
• Lumen
PHP Community Summit by locaweb
Analisando os logs
Logs, pra que te quero!
PHP Community Summit by locaweb
Como visualizar?
• Na sua maquina local, pode acessar diretamente o arquivo
$ tail -f /path/to/log
PHP Community Summit by locaweb
Como visualizar?
• Em produção, caso tenha acesso a máquina via ssh
$ ssh -i ~/.ssh/key.pem user@host tail –f /path/to/log
• E se o seu ambiente for composto por 35 hosts?
PHP Community Summit by locaweb
Você pode precisar de
• Agregação e centralização de logs
• Pesquisa por determinadas ocorrências
• Geração de métricas (KPIs e SLA)
• Alertas e notificações
PHP Community Summit by locaweb
Serviços Externos
PHP Community Summit by locaweb
Sentry
PHP Community Summit by locaweb
Sentry
PHP Community Summit by locaweb
Handlers Customizados
Logs, pra que te quero!
PHP Community Summit by locaweb
Resumindo...
• Organize os logs gerados pela aplicação
• Crie processos de revisão periódica dos logs
• Automatize o envio de alertas
• Centralize os logs da aplicação
• Cruze com outros logs (servidor web, banco de dados)
PHP Community Summit by locaweb
Obrigado!
gmsantos
gmsantos__
gmsantos
gmsantos
Exemplos disponíveis em:
https://github.com/gmsantos/php-community-summit-logs
PHP Community Summit by locaweb

Logs, pra que te quero! @ PHP Community Summit by locaweb 2017

  • 1.
    Logs, pra quete quero! PHP Community Summit by locaweb
  • 2.
    > whoiam • DesenvolvedorBackend @ Leroy Merlin • Instrutor @ Treinaweb • Zend Certified PHP Engineer • MCSA SQL Server (2012/2014/2016) PHP Community Summit by locaweb
  • 3.
    Tópicos • O quesão logs? • Características de um bom log • Níveis de Criticidade • PSR-3 • Monolog • Analise de logs • Serviços externos PHP Community Summit by locaweb
  • 4.
    O que sãoLogs? • “Quando o homem avançou o mar, na época dos grandes descobrimentos, para deixar registrado os eventos ocorridos durante a viagem foi comum a criação de um log, no sentido de ser um 'diário de bordo'.” - Wikipedia PHP Community Summit by locaweb
  • 5.
    O que sãoLogs? PHP Community Summit by locaweb
  • 6.
    O que sãoLogs? PHP Community Summit by locaweb
  • 7.
    O que sãoLogs? PHP Community Summit by locaweb
  • 8.
    O que sãoLogs? PHP Community Summit by locaweb
  • 9.
    Características de umbom log Logs, pra que te quero! PHP Community Summit by locaweb
  • 10.
    Ser claro einformativo // mensagens que não dizem nada [2017-07-20 02:41:11] INFO: foi [2017-07-20 02:41:11] DEBUG: vai [2017-07-20 02:41:11] NOTICE: passou!! [2017-07-20 02:41:11] DEBUG: 2 [2017-07-20 02:41:11] DEBUG: 3 [2017-07-20 02:41:11] DEBUG: 4 // sem detalhes do evento [2017-07-20 02:41:11] WARNING: Unable to sync Sale Order PHP Community Summit by locaweb
  • 11.
    Ter contexto // Explicaro que está acontecendo [2017-07-20 02:48:25] INFO: Starting csv file import {"file":"/path/file.csv"} [] [2017-07-20 02:48:25] DEBUG: Reading csv file [] [] [2017-07-20 02:48:25] NOTICE: Skip header {"line":1} [] [2017-07-20 02:48:25] DEBUG: Loading row 2 {"line":2,"data":{"some":"data"}} [] [2017-07-20 02:48:25] DEBUG: Loading row 3 {"line":3,"data":{"some":"data"}} [] [2017-07-20 02:48:25] DEBUG: Loading row 4 {"line":4,"data":{"some":"data"}} [] // Incluir informações sobre o contexto [2017-07-20 02:48:25] WARNING: Unable to sync Sale Order {"id":123} {"file":"/mnt/c/Users/gabri/Projects/tdc/good- logs.php","line":32,"class":null,"function":null} PHP Community Summit by locaweb
  • 12.
    Fácil de pesquisare agrupar // Repensar logs com mensagem dinâmica ERROR: Allowed memory size of 5202142 bytes exhausted (tried to allocate 370697 bytes) ERROR: Allowed memory size of 2916448 bytes exhausted (tried to allocate 251567 bytes) ERROR: Allowed memory size of 4127488 bytes exhausted (tried to allocate 895479 bytes) // Incluir tags INFO: Starting csv file import {"file":"/path/file.csv"} {"tags":["integration","product"]} NOTICE: Skip header {"line":1} {"tags":["integration","product"]} DEBUG: Loading row 2 {"line":2,"data":{"some":"data"}} {"tags":["integration","product"]} DEBUG: Loading row 3 {"line":3,"data":{"some":"data"}} {"tags":["integration","product"]} DEBUG: Loading row 4 {"line":4,"data":{"some":"data"}} {"tags":["integration","product"]} PHP Community Summit by locaweb
  • 13.
    Utilizar níveis decriticidade PHP Community Summit by locaweb
  • 14.
    Analise seus logs •Antecipe problemas analisando seus logs • Tenha rotinas para ver logs não críticos • Não use seus logs só para apagar incêndios PHP Community Summit by locaweb
  • 15.
    Níveis de Criticidade Logs,pra que te quero! PHP Community Summit by locaweb
  • 16.
    Níveis de Criticidade 0 1 2 3 4 5 6 7 8 Level •Debug Contém informações detalhadas para debug Geralmente é desligado em produção (Ex: Iterações de um loop, query SQL gerada pelo ORM) PHP Community Summit by locaweb
  • 17.
    Níveis de Criticidade 0 1 2 3 4 5 6 7 8 Level •Info Eventos comuns ocorridos no sistema (Ex.: Usuário fez login, hits na API) PHP Community Summit by locaweb
  • 18.
    Níveis de Criticidade 0 1 2 3 4 5 6 7 8 Level •Notice Eventos comuns, porém com certa relevância no sistema PHP Community Summit by locaweb
  • 19.
    Níveis de Criticidade 0 1 2 3 4 5 6 7 8 Level •Warning Eventos não caracterizados como erro, mas que merecem uma certa atenção (Ex.: Uso de funções descontinuadas) PHP Community Summit by locaweb
  • 20.
    Níveis de Criticidade 0 1 2 3 4 5 6 7 8 Level •Error Erros encontrados em tempo de execução Exceptions não tratadas aparecem aqui PHP Community Summit by locaweb
  • 21.
    Níveis de Criticidade 0 1 2 3 4 5 6 7 8 Level •Critical Condições críticas no sistema, como falha de serviços externos Pode ser usado para medir nível de serviço (SLA) PHP Community Summit by locaweb
  • 22.
    Níveis de Criticidade 0 1 2 3 4 5 6 7 8 Level •Alert Requer uma ação corretiva imediata Aqui alguém vai te ligar, enviar SMS, @channel no Slack, sinal de fumaça PHP Community Summit by locaweb
  • 23.
    Níveis de Criticidade 0 1 2 3 4 5 6 7 8 Level •Emergency Sistema está em um estado não utilizável É raro no nível da aplicação PHP Community Summit by locaweb
  • 24.
    E no PHP,como faz? Logs, pra que te quero! PHP Community Summit by locaweb
  • 25.
    PSR-3 • Padrão deLogs para PHP • De acordo com os níveis de criticidade da IETF RFC 5424 • Algumas implementações: monolog, zend-log, log4php Especificação da PSR-3 PHP Community Summit by locaweb
  • 26.
    Monolog • Handlers • Destinodo log • Formatters • Formato em que o log será enviado • Processors • Informações extras para o log PHP Community Summit by locaweb
  • 27.
    Handlers • StreamHandler • RotatingFileHandler •SlackWebhookHandler • MandrillHandler • NewRelicHandler • LogEntriesHandler • NullHandler PHP Community Summit by locaweb
  • 28.
    Formatters • LineFormatter • HtmlFormatter •JsonFormatter • ChromePHPFormatter • LogstashFormatter PHP Community Summit by locaweb
  • 29.
    Processors • PsrLogMessageProcessor • IntrospectionProcessor •WebProcessor • MemoryPeakUsageProcessor • GitProcessor • TagProcessor PHP Community Summit by locaweb
  • 30.
    Exemplos <?php require_once __DIR__ .'/vendor/autoload.php'; use MonologHandlerStreamHandler; use MonologLogger; $logger = new Logger('my_logger'); $logger->pushHandler(new StreamHandler(__DIR__.'/my_app.log')); $logger->info('Hello World!'); // my_app.log: [2017-07-20 00:51:27] my_logger.INFO: Hello World! [] [] PHP Community Summit by locaweb
  • 31.
    Exemplos use MonologHandlerRotatingFileHandler; $logger->pushHandler(new RotatingFileHandler(__DIR__.'/error.log',3, Logger::ERROR)); $logger->debug('Debug event'); $logger->error('Error event'); // my_app.log: [2017-07-20 01:10:21] my_logger.DEBUG: Debug event [] [] [2017-07-20 01:10:21] my_logger.ERROR: Error event [] [] // error-2017-07-20.log [2017-07-20 01:10:22] my_logger.ERROR: Error event [] [] PHP Community Summit by locaweb
  • 32.
    Exemplos use MonologProcessorIntrospectionProcessor; $logger->pushProcessor(new IntrospectionProcessor(Logger::WARNING)); $logger->notice('Importantevent'); $logger->warning('Deprecated: Lorem Ipsum...'); // my_app.log: [2017-07-20 01:25:02] my_logger.NOTICE: Important event [] [] [2017-07-20 01:26:03] my_logger.WARNING: Deprecated: Lorem Ipsum... [] {"file":"/mnt/c/Users/gabri/Projects/tdc/bootstrap.php","line":21,"class":null,"function":n ull} PHP Community Summit by locaweb
  • 33.
    Exemplos $data = ['user'=> 'TDC']; $logger->info('User '. $data['user'] .' logged', $data); // without Psr Processor use MonologProcessorPsrLogMessageProcessor; $logger->info('User {user} logged', $data); // with Psr Processor // my_app.log: [2017-07-20 01:25:02] my_logger.INFO: User TDC logged {"user":"TDC"} [] [2017-07-20 01:25:02] my_logger.INFO: User TDC logged {"user":"TDC"} [] PHP Community Summit by locaweb
  • 34.
    Exemplos $rotatingFileHandler = $logger->popHandler(); $fileHandler= $logger->popHandler(); $htmlHandler = new StreamHandler(__DIR__.'/log.html', Logger::DEBUG); use MonologFormatterLineFormatter; use MonologFormatterJsonFormatter; use MonologFormatterHtmlFormatter; $fileHandler->setFormatter(new LineFormatter("%level_name%: %message% %context% %extra%n")); $rotatingFileHandler->setFormatter(new JsonFormatter()); $htmlHandler->setFormatter(new HtmlFormatter()); $logger->setHandlers([$fileHandler, $rotatingFileHandler, $htmlHandler]); $logger->error('Unhandled Expection: Lorem ipsum', ['user' => 'locaweb']); $logger->critical('User {user} is trying to hack us!', ['id' => 666, 'user' => 'locaweb',]); PHP Community Summit by locaweb
  • 35.
    Exemplos // my_app.log [2017-07-20 02:00:18]my_logger.INFO: User locaweb logged {"user":"locaweb "} [] ERROR: Unhandled Expection: Lorem ipsum {"user":"locaweb"} {"file":"/mnt/c/Users/gabri/Projects/tdc/bootstrap.php","line":51,"class":null,"function":n ull} CRITICAL: User locaweb is trying to hack us! {"id":666,"user":"locaweb "} {"file":"/mnt/c/Users/gabri/Projects/tdc/bootstrap.php","line":52,"class":null,"function":n ull} PHP Community Summit by locaweb
  • 36.
    Exemplos // error-2017-07-20.log [2017-07-20 02:00:18]my_logger.ERROR: Error event [] [] {"message":"Unhandled Expection: Lorem ipsum","context":{"user":"locaweb"},"level":400,"level_name":"ERROR","channel":"my_logger", "datetime":{"date":"2017-07-20 02:00:18.608935","timezone_type":3,"timezone":"UTC"},"extra":{"file":"/mnt/c/Users/gabri/Pr ojects/tdc/bootstrap.php","line":51,"class":null,"function":null}} {"message":"User locaweb is trying to hack us!","context":{"id":666,"user":"locaweb"},"level":500,"level_name":"CRITICAL","channel":"m y_logger","datetime":{"date":"2017-07-20 02:00:18.610325","timezone_type":3,"timezone":"UTC"},"extra":{"file":"/mnt/c/Users/gabri/Pr ojects/tdc/bootstrap.php","line":52,"class":null,"function":null}} PHP Community Summit by locaweb
  • 37.
  • 38.
    Como usar noseu projeto? Logs, pra que te quero! PHP Community Summit by locaweb
  • 39.
    Projetos com suporteMonolog • Symfony • Laravel • Zend Framework * • Drupal * • Magento • Expressive * • Silex • Lumen PHP Community Summit by locaweb
  • 40.
    Analisando os logs Logs,pra que te quero! PHP Community Summit by locaweb
  • 41.
    Como visualizar? • Nasua maquina local, pode acessar diretamente o arquivo $ tail -f /path/to/log PHP Community Summit by locaweb
  • 42.
    Como visualizar? • Emprodução, caso tenha acesso a máquina via ssh $ ssh -i ~/.ssh/key.pem user@host tail –f /path/to/log • E se o seu ambiente for composto por 35 hosts? PHP Community Summit by locaweb
  • 43.
    Você pode precisarde • Agregação e centralização de logs • Pesquisa por determinadas ocorrências • Geração de métricas (KPIs e SLA) • Alertas e notificações PHP Community Summit by locaweb
  • 44.
  • 45.
  • 46.
  • 47.
    Handlers Customizados Logs, praque te quero! PHP Community Summit by locaweb
  • 48.
    Resumindo... • Organize oslogs gerados pela aplicação • Crie processos de revisão periódica dos logs • Automatize o envio de alertas • Centralize os logs da aplicação • Cruze com outros logs (servidor web, banco de dados) PHP Community Summit by locaweb
  • 49.