Re: log tailing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Jun 30, 2012 at 2:30 PM, Daniel Brown <danbrown@xxxxxxx> wrote:
>
> <?php
>
> $ssh_entries = explode(PHP_EOL,trim(`tail /var/log/syslog | awk
> {'print $1,$2,$3 "|" $5 "|" $11'}`));

    Actually, the above was intended to grab just sshd entries, so
instead of 'tail' you should use 'grep sshd' in the line above.


> foreach ($ssh_entries as $s) {
>        $l = explode('|',$s);
>
>        // Remember to do whatever sanity necessary!
>        $sql = "INSERT INTO ssh_activity
> VALUES('".$l[0]."','".$l[1]."','".$l[2]."')";
> }
> ?>
>
> --
> </Daniel P. Brown>
> Network Infrastructure Manager
> http://www.php.net/



-- 
</Daniel P. Brown>
Network Infrastructure Manager
http://www.php.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux