array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'fr', ), 'this' => array ( 0 => 'varnish.example.log.php', 1 => 'Exemple d\'utilisation de VarnishLog', ), 'up' => array ( 0 => 'varnish.examples.php', 1 => 'Exemples', ), 'prev' => array ( 0 => 'varnish.example.stat.php', 1 => 'Exemple d\'utilisation de VarnishStat', ), 'next' => array ( 0 => 'class.varnishadmin.php', 1 => 'VarnishAdmin', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'fr', 'path' => 'reference/varnish/examples.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>
Cet exemple montre comme lire des lignes des logs Varnish depuis la mémoire partagée.
Exemple #1 Lecture des logs Varnish depuis la mémoire partagée
<?php
$vl = new VarnishLog;
while(1) {
$line = $vl->getLine();
printf("%s %d %s", VarnishLog::getTagName($line['tag']), $line['id'],
$line['data']);
}
exit(0);
?>