Views: 46
NAS設備:
QNAP + LogSys
Synology + LogSys
OMV(Debian) + LogSys
分析工具:
win + AMP (A=> Apache、 M=> mysql、 P=> PHP) + LogAnalyzer
修改:LogAnalyzer – config.php 檔案
$Sid = 1;
// # 指定目錄路徑
$directory = ‘//192.168.6.253/RemoteLog’;
// # 列出所有檔案目錄,去除「.」與「..」目錄
$items = array_diff(scandir($directory), array(‘..’, ‘.’));
//單位換算
function formatBytes($Fsize) {
$units = array(‘ B’, ‘ KB’, ‘ MB’, ‘ GB’, ‘ TB’);
for ($i = 0; $Fsize >= 1024 && $i < 4; $i++) $Fsize /= 1024;
return round($Fsize, 2).$units[$i];
}
// # 輸出檔案目錄
foreach ($items as $item) {
//if (is_dir($item)) {
if (is_dir($directory . '/' . $item)) {
$files = glob("$directory/$item/*");
rsort($files);
foreach($files as $msg){
$CFG['DefaultSourceID'] = 'Source'.$Sid;
$CFG['Sources']['Source'.$Sid]['ID'] = 'Source'.$Sid;
$CFG['Sources']['Source'.$Sid]['Name'] = str_replace("$directory/$item/","",$msg); //'Source'.$Sid;
//重整Name去掉目錄,留下檔名
$CFG['Sources']['Source'.$Sid]['Name'] = '['.$item.']_'.str_replace("$directory/","",$CFG['Sources']['Source'.$Sid]['Name']).' ('.formatBytes($Fsize=filesize($msg)).')'; //'Source'.$Sid
$CFG['Sources']['Source'.$Sid]['ViewID'] = 'SYSLOG';
$CFG['Sources']['Source'.$Sid]['SourceType'] = SOURCE_DISK;
$CFG['Sources']['Source'.$Sid]['LogLineType'] = 'syslog';
$CFG['Sources']['Source'.$Sid]['DiskFile'] = $msg;
$Sid++;
}
} //if
} //foreach
*網路無遠弗屆!與您簡單分享從這些科技輔具相關資源之所學經驗,錯漏之處在所難免,尚祈各方不吝指正,欲求詳盡,善用網路搜尋!知識技術無價,應用服務有價!
本頁連結(528222836):Log收集分析