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.

archived.php 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <?php
  2. require 'inc/pre.inc.php';
  3. define('TITLE', _('Archived'));
  4. require 'tpl/head.inc.php';
  5. define('INC_FOOTER', 'tpl/foot.inc.php');
  6. $l = null;
  7. try {
  8. $l = new Lggr($state, $config);
  9. }
  10. catch (LggrException $e) {
  11. echo '<div class="container"><div class="alert alert-danger" role="alert">' . $e->getMessage() . '</div></div>';
  12. require INC_FOOTER;
  13. exit();
  14. }
  15. $page = $state->getPage();
  16. try {
  17. $aEvents = $l->getArchived($page * LggrState::PAGELEN, LggrState::PAGELEN);
  18. $searchvalue = '';
  19. $searchvalueprog = '';
  20. $isSearch = false;
  21. }
  22. catch (LggrException $e) {
  23. echo '<div class="container"><div class="alert alert-danger" role="alert">' . $e->getMessage() . '</div></div>';
  24. require INC_FOOTER;
  25. exit();
  26. }
  27. if (version_compare(phpversion(), '5.4', '<')) {
  28. echo '<div class="container"><div class="alert alert-danger" role="alert">Your PHP version ' .
  29. phpversion() . ' might be too old, expecting at least 5.4</div></div>';
  30. } // if
  31. require 'tpl/nav.inc.php';
  32. ?>
  33. <div class="container" id="infoheader">
  34. <?= _('Archived') ?>, <a href="./do.php?a=exportarchive"
  35. target="_blank">export</a> to csv.
  36. </div>
  37. <div class="container">
  38. <?php
  39. if (0 == count($aEvents)) {
  40. echo '<div class="alert alert-danger" role="alert">' . _('empty result') .
  41. '</div>';
  42. } // if
  43. ?>
  44. </div>
  45. <!-- class container for fixed max width, or container-fluid for maximum width -->
  46. <div class="container-fluid datablock">
  47. <?php
  48. if (! $isSearch) {
  49. include 'tpl/paginate.inc.php';
  50. } // if
  51. include 'tpl/containerhead.inc.php';
  52. $i = 0;
  53. foreach ($aEvents as $event) {
  54. $i ++;
  55. if (0 == $i % 2) {
  56. $rowclass = 'even';
  57. } else {
  58. $rowclass = 'odd';
  59. } // if
  60. switch ($event->level) {
  61. case 'emerg':
  62. $label = '<span class="label label-danger">Emergency</span>';
  63. break;
  64. case 'crit':
  65. $label = '<span class="label label-danger">Critical</span>';
  66. break;
  67. case 'err':
  68. $label = '<span class="label label-danger">Error</span>';
  69. break;
  70. case 'warning':
  71. $label = '<span class="label label-warning">Warning</span>';
  72. break;
  73. case 'notice':
  74. $label = '<span class="label label-primary">Notice</span>';
  75. break;
  76. case 'info':
  77. $label = '<span class="label label-success">Info</span>';
  78. break;
  79. default:
  80. $label = '<span class="label label-default">' . $event->level .
  81. '</span>';
  82. } // switch
  83. switch ($event->archived) {
  84. case 'Y':
  85. $archived = '<span id="arch' . $event->id .
  86. '" class="lggr-archived glyphicon glyphicon-warning-sign" aria-hidden="true" title="archived"></span>';
  87. break;
  88. case 'N':
  89. $archived = '<span id="arch' . $event->id .
  90. '" class="lggr-notarchived glyphicon glyphicon-pushpin" aria-hidden="true" title=""></span>';
  91. break;
  92. default:
  93. $archived = '?';
  94. } // switch
  95. $host = htmlentities($event->host, ENT_HTML5 | ENT_SUBSTITUTE | ENT_QUOTES);
  96. $program = htmlentities($event->program,
  97. ENT_HTML5 | ENT_SUBSTITUTE | ENT_QUOTES);
  98. $msg = htmlentities($event->message, ENT_HTML5 | ENT_SUBSTITUTE | ENT_QUOTES);
  99. echo <<<EOL
  100. <div class="row datarow $rowclass" data-id="{$event->id}">
  101. <div class="col-md-2 col-xs-6 newlog-date">{$event->date}</div>
  102. <div class="col-md-1 col-xs-2">{$event->facility}</div>
  103. <div class="col-md-1 col-xs-2">$archived $label</div>
  104. <div class="col-md-1 col-xs-2">$host</div>
  105. <div class="col-md-2 col-xs-12">$program</div>
  106. <div class="col-md-5 col-xs-12 newlog-msg" title="$msg"><tt>{$msg}</tt></div>
  107. </div><!-- row -->
  108. EOL;
  109. } // foreach
  110. ?>
  111. <div id="dialog" title="Details">I'm a dialog</div>
  112. <?php
  113. if (! $isSearch) {
  114. include 'tpl/paginate.inc.php';
  115. } // if
  116. ?>
  117. </div>
  118. <?php
  119. $aPerf = $l->getPerf();
  120. require INC_FOOTER;
  121. ?>
Social stuff:
Mastodon