当前位置: 首页>>代码示例>>PHP>>正文


PHP unix::StringToGrep方法代码示例

本文整理汇总了PHP中unix::StringToGrep方法的典型用法代码示例。如果您正苦于以下问题:PHP unix::StringToGrep方法的具体用法?PHP unix::StringToGrep怎么用?PHP unix::StringToGrep使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在unix的用法示例。


在下文中一共展示了unix::StringToGrep方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: access_events

function access_events()
{
    $filename = "/var/log/squid/haarp.access.log";
    $search = $_GET["access-events"];
    $unix = new unix();
    $search = $unix->StringToGrep($search);
    $grep = $unix->find_program("grep");
    $tail = $unix->find_program("tail");
    $refixcmd = "{$tail} -n 2500 {$filename}";
    if ($search != null) {
        $refixcmd = $refixcmd . "|{$grep} -i -E '{$search}'|{$tail} -n 500";
    } else {
        $refixcmd = "{$tail} -n 500 {$filename}";
    }
    exec($refixcmd . " 2>&1", $results);
    writelogs_framework($refixcmd . " (" . count($results) . ")", __FUNCTION__, __FILE__, __LINE__);
    echo "<articadatascgi>" . base64_encode(serialize($results)) . "</articadatascgi>";
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:18,代码来源:haarp.php

示例2: audit_log

function audit_log()
{
    $unix = new unix();
    $grep = $unix->find_program("grep");
    $tail = $unix->find_program("tail");
    $search = trim(base64_decode($_GET["filter"]));
    $maillog = "/var/log/auth.log";
    $prefix = "{$grep} -i -E '\\s+zarafa\\-(spooler|server|gateway|dagent|license)\\[' {$maillog}|";
    $max = 500;
    if (isset($_GET["rp"])) {
        $max = $_GET["rp"];
    }
    if ($search != null) {
        $search = $unix->StringToGrep($search);
        $cmd = "{$prefix}{$grep} -i -E '{$search}' |{$tail} -n {$max} 2>&1";
    } else {
        $cmd = "{$prefix}{$tail} -n {$max} 2>&1";
    }
    writelogs_framework("{$cmd}", __FUNCTION__, __FILE__, __LINE__);
    exec($cmd, $results);
    echo "<articadatascgi>" . base64_encode(serialize($results)) . "</articadatascgi>";
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:22,代码来源:zarafa.php

示例3: fetchmail_logs

function fetchmail_logs()
{
    $unix = new unix();
    $search = trim(base64_decode($_GET["search"]));
    $tail = $unix->find_program("tail");
    $grep = $unix->find_program("grep");
    $sourcefile = "/var/log/fetchmail.log";
    $rp = 25;
    if (is_numeric($_GET["rp"])) {
        $rp = $_GET["rp"];
    }
    if ($search == null) {
        $cmd = "{$tail} -n {$rp} {$sourcefile} 2>&1";
        writelogs_framework($cmd, __FUNCTION__, __FILE__, __LINE__);
        exec($cmd, $results);
        echo "<articadatascgi>" . base64_encode(serialize($results)) . "</articadatascgi>";
        return;
    }
    $search = $unix->StringToGrep($search);
    exec("{$grep} -i -E '{$search}' /var/log/fetchmail.log|{$tail} -n {$rp}", $results);
    echo "<articadatascgi>" . base64_encode(serialize($results)) . "</articadatascgi>";
}
开发者ID:articatech,项目名称:artica,代码行数:22,代码来源:cmd.php

示例4: www_events

function www_events()
{
    $servername = $_GET["servername"];
    $port = $_GET["port"];
    $type = $_GET["type"];
    $filename = "/var/log/apache2/{$servername}/nginx.access.log";
    if ($type == 2) {
        $filename = "/var/log/apache2/{$servername}/nginx.error.log";
    }
    $search = $_GET["search"];
    $unix = new unix();
    $search = $unix->StringToGrep($search);
    $grep = $unix->find_program("grep");
    $tail = $unix->find_program("tail");
    $refixcmd = "{$tail} -n 2500 {$filename}";
    if ($search != null) {
        $refixcmd = $refixcmd . "|{$grep} -i -E '{$search}'|{$tail} -n 500";
    } else {
        $refixcmd = "{$tail} -n 500 {$filename}";
    }
    exec($refixcmd . " 2>&1", $results);
    writelogs_framework($refixcmd . " (" . count($results) . ")", __FUNCTION__, __FILE__, __LINE__);
    echo "<articadatascgi>" . base64_encode(serialize($results)) . "</articadatascgi>";
}
开发者ID:articatech,项目名称:artica,代码行数:24,代码来源:nginx.php

示例5: query_maillog

function query_maillog()
{
    $unix = new unix();
    $maillog = $_GET["maillog"];
    if ($maillog == null) {
        echo "<articadatascgi>" . base64_encode(serialize(array())) . "</articadatascgi>";
        return;
    }
    $maillogSecond = $maillog;
    $grep = $unix->find_program("grep");
    $tail = $unix->find_program("tail");
    $search = trim(base64_decode($_GET["filter"]));
    $emails = unserialize(base64_decode($_GET["emails"]));
    $zz = array();
    if (count($emails) > 0) {
        while (list($num, $line) = each($emails)) {
            if (trim($line) == null) {
                continue;
            }
            $zz[] = $line;
        }
        if (count($zz) > 0) {
            $searchEmails = "(" . @implode("|", $zz) . ")";
            writelogs_framework("searchEmails = \"{$searchEmails}\"", __FUNCTION__, __FILE__, __LINE__);
            $searchEmails = str_replace(".", "\\.", $searchEmails);
            $searchEmails = ".*?{$searchEmails}";
        }
    }
    if (isset($_GET["zarafa-filter"])) {
        if ($_GET["zarafa-filter"] == "yes") {
            $_GET["prefix"] = "\\s+zarafa\\-(spooler|server|gateway|dagent|license){$searchEmails}";
        }
    }
    if (isset($_GET["miltergrey-filter"])) {
        if ($_GET["miltergrey-filter"] == "yes") {
            $_GET["prefix"] = "\\s+milter-greylist{$searchEmails}";
        }
    }
    if (isset($_GET["mimedefang-filter"])) {
        if ($_GET["mimedefang-filter"] == "yes") {
            $_GET["prefix"] = "\\s+mimedefang(\\-multiplexor|\\[){$searchEmails}";
        }
    }
    if (isset($_GET["prefix"])) {
        $prefix = "{$grep} -i -E '{$_GET["prefix"]}(\\[|:){$searchEmails}' {$maillog}|";
        $maillogSecond = null;
    }
    $filename = "/usr/share/artica-postfix/ressources/logs/web/query.mail.log";
    $max = 500;
    if (isset($_GET["rp"])) {
        $max = $_GET["rp"];
    }
    if ($search != null) {
        $search = $unix->StringToGrep($search);
        if ($searchEmails != null) {
            $cmd = "{$prefix}{$grep} -i -E '{$searchEmails}' {$maillog}|{$grep} -E '{$search}'|{$tail} -n {$max} >{$filename} 2>&1";
        } else {
            $cmd = "{$prefix}{$grep} -i -E '{$search}' {$maillogSecond}|{$tail} -n {$max} >{$filename} 2>&1";
        }
    } else {
        if ($prefix != null) {
            $cmd = "{$prefix}{$tail} -n {$max} >{$filename} 2>&1";
        } else {
            if ($searchEmails != null) {
                $cmd = "{$grep} -i -E '{$searchEmails}' {$maillog}|{$tail} -n {$max} >{$filename} 2>&1";
            } else {
                $cmd = "{$tail} -n {$max} {$maillog} >{$filename} 2>&1";
            }
        }
    }
    writelogs_framework("{$cmd}", __FUNCTION__, __FILE__, __LINE__);
    exec($cmd, $results);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:73,代码来源:postfix.php

示例6: events

function events()
{
    $search = trim(base64_decode($_GET["ss5events"]));
    $unix = new unix();
    $tail = $unix->find_program("tail");
    $grep = $unix->find_program("grep");
    $rp = 500;
    if (is_numeric($_GET["rp"])) {
        $rp = $_GET["rp"];
    }
    if ($search == null) {
        $cmd = "{$grep} -i -E 'Crunch:' /var/log/privoxy/privoxy.log|{$tail} -n {$rp} 2>&1";
        writelogs_framework($cmd, __FUNCTION__, __FILE__, __LINE__);
        exec($cmd, $results);
        @file_put_contents("/usr/share/artica-postfix/ressources/logs/web/privoxy-events", serialize($results));
        return;
    }
    $search = $unix->StringToGrep($search);
    $cmd = "{$grep} -i -E 'Crunch:' /var/log/privoxy/privoxy.log|{$grep} -i -E '{$search}'|{$tail} -n {$rp} 2>&1";
    writelogs_framework($cmd, __FUNCTION__, __FILE__, __LINE__);
    exec("{$cmd}", $results);
    @file_put_contents("/usr/share/artica-postfix/ressources/logs/web/privoxy-events", serialize($results));
}
开发者ID:articatech,项目名称:artica,代码行数:23,代码来源:privoxy.php

示例7: squiddb_query

function squiddb_query()
{
    $filelog = "/opt/squidsql/error.log";
    $unix = new unix();
    $grep = $unix->find_program("grep");
    $tail = $unix->find_program("tail");
    $search = trim(base64_decode($_GET["search"]));
    $prefix = null;
    $max = 500;
    if (isset($_GET["rp"])) {
        $max = $_GET["rp"];
    }
    if ($search != null) {
        $prefix = "{$grep} -i -E '{$search}' {$filelog}| ";
    }
    if ($search != null) {
        $search = $unix->StringToGrep($search);
        $cmd = "{$grep} -i -E '{$search}' {$filelog}| {$tail} -n {$max} 2>&1";
    } else {
        $cmd = "{$tail} -n {$max} {$filelog} 2>&1";
    }
    writelogs_framework("{$cmd}", __FUNCTION__, __FILE__, __LINE__);
    exec($cmd, $results);
    echo "<articadatascgi>" . base64_encode(serialize($results)) . "</articadatascgi>";
}
开发者ID:articatech,项目名称:artica,代码行数:25,代码来源:system.php

示例8: accesslogs

function accesslogs()
{
    $search = trim(base64_decode($_GET["accesslogs"]));
    $OnlyIpAddr = $_GET["OnlyIpAddr"];
    if ($OnlyIpAddr != null) {
        $OnlyIpAddr = str_replace(".", "\\.", $OnlyIpAddr);
        $OnlyIpAddr = ".*?{$OnlyIpAddr}";
    }
    $unix = new unix();
    $tail = $unix->find_program("tail");
    $grep = $unix->find_program("grep");
    $rp = 500;
    if (is_numeric($_GET["rp"])) {
        $rp = $_GET["rp"];
    }
    if ($search == null) {
        $cmd = "{$tail} -n 3000 /var/log/auth.log|{$grep} -i -E 'squid.*?{$OnlyIpAddr}'|{$tail} -n {$rp} 2>&1";
        writelogs_framework($cmd, __FUNCTION__, __FILE__, __LINE__);
        exec("{$cmd}", $results);
        echo "<articadatascgi>" . base64_encode(serialize($results)) . "</articadatascgi>";
        return;
    }
    $search = $unix->StringToGrep($search);
    $cmd = "{$tail} -n 3000 /var/log/auth.log|{$grep} -i -E 'squid([\\[|\\-])' 2>&1|{$grep} -E '{$search}' 2>&1|{$tail} -n {$rp} 2>&1";
    writelogs_framework($cmd, __FUNCTION__, __FILE__, __LINE__);
    exec("{$cmd}", $results);
    echo "<articadatascgi>" . base64_encode(serialize($results)) . "</articadatascgi>";
}
开发者ID:articatech,项目名称:artica,代码行数:28,代码来源:squid.php


注:本文中的unix::StringToGrep方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。