array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'pt_BR', ), 'this' => array ( 0 => 'varnish.example.log.php', 1 => 'Basic VarnishLog usage', ), 'up' => array ( 0 => 'varnish.examples.php', 1 => 'Exemplos', ), 'prev' => array ( 0 => 'varnish.example.stat.php', 1 => 'Basic VarnishStat usage', ), 'next' => array ( 0 => 'class.varnishadmin.php', 1 => 'VarnishAdmin', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/varnish/examples.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

Basic VarnishLog usage

The example illustrates reading varnish log lines from shared memory

Exemplo #1 Read varnish shared memory log

<?php

$vl
= new VarnishLog;
while(
1) {
$line = $vl->getLine();
printf("%s %d %s", VarnishLog::getTagName($line['tag']), $line['id'],
$line['data']);
}

exit(
0);
?>