The web based syslog https://lggr.io
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

live.php 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <?php
  2. require 'inc/pre.inc.php';
  3. define('TITLE', 'live');
  4. require 'tpl/head.inc.php';
  5. $l = null;
  6. try {
  7. $l = new Lggr($state, $config);
  8. $aEvents = $l->getLatest(0, LggrState::PAGELEN);
  9. }
  10. catch (LggrException $e) {
  11. echo '<div class="container"><div class="alert alert-danger" role="alert">' .
  12. $e->getMessage() . '</div></div>';
  13. require 'tpl/foot.inc.php';
  14. exit();
  15. }
  16. $searchvalueprog = '';
  17. $searchvalue = '';
  18. require 'tpl/nav.inc.php';
  19. ?>
  20. <div class="container">
  21. <?php
  22. if (0 == count($aEvents)) {
  23. echo '<div class="alert alert-danger" role="alert">' . _('empty result') .
  24. '</div>';
  25. } // if
  26. ?>
  27. </div>
  28. <div id="liveheader" class="container">
  29. <h2>
  30. <span class="glyphicon glyphicon-refresh" aria-hidden="true"></span> <?= _('Live view') ?> <span
  31. id="tslatest"></span> <a id="pauseplay" href="#"><span
  32. class="glyphicon glyphicon-pause"></span></a>
  33. </h2>
  34. </div>
  35. <div class="container-fluid">
  36. <?php
  37. include 'tpl/containerhead.inc.php';
  38. ?>
  39. </div>
  40. <div class="container-fluid datablock">
  41. <?php
  42. $i = 0;
  43. foreach ($aEvents as $event) {
  44. $i ++;
  45. if (0 == $i % 2) {
  46. $rowclass = 'even';
  47. } else {
  48. $rowclass = 'odd';
  49. } // if
  50. switch ($event->level) {
  51. case 'emerg':
  52. $label = '<span class="label label-danger">Emergency</span>';
  53. break;
  54. case 'crit':
  55. $label = '<span class="label label-danger">Critical</span>';
  56. break;
  57. case 'err':
  58. $label = '<span class="label label-danger">Error</span>';
  59. break;
  60. case 'warning':
  61. $label = '<span class="label label-warning">Warning</span>';
  62. break;
  63. case 'notice':
  64. $label = '<span class="label label-primary">Notice</span>';
  65. break;
  66. case 'info':
  67. $label = '<span class="label label-success">Info</span>';
  68. break;
  69. default:
  70. $label = '<span class="label label-default">' . $event->level .
  71. '</span>';
  72. } // switch
  73. $host = htmlentities($event->host, ENT_HTML5 | ENT_SUBSTITUTE | ENT_QUOTES);
  74. $program = htmlentities($event->program,
  75. ENT_HTML5 | ENT_SUBSTITUTE | ENT_QUOTES);
  76. $msg = htmlentities($event->message, ENT_HTML5 | ENT_SUBSTITUTE | ENT_QUOTES);
  77. echo <<<EOL
  78. <div class="row datarow $rowclass" data-id="{$event->id}">
  79. <div class="col-md-2 col-xs-6 newlog-date">{$event->date}</div>
  80. <div class="col-md-1 col-xs-2">{$event->facility}</div>
  81. <div class="col-md-1 col-xs-2">$label</div>
  82. <div class="col-md-1 col-xs-2">$host</div>
  83. <div class="col-md-2 col-xs-12">$program</div>
  84. <div class="col-md-5 col-xs-12 newlog-msg" title="$msg"><tt>{$msg}</tt></div>
  85. </div><!-- row -->
  86. EOL;
  87. } // foreach
  88. ?>
  89. <div id="dialog" title="Details">I'm a dialog</div>
  90. </div>
  91. <?php
  92. $aPerf = $l->getPerf();
  93. require 'tpl/foot.inc.php'?>
Social stuff:
Mastodon