---------- Forwarded message ---------- From: "tamouse mailing lists" <tamouse.lists@xxxxxxxxx> Date: Jun 30, 2012 4:35 PM Subject: Re: log tailing To: "Daniel Brown" <danbrown@xxxxxxx> On Jun 30, 2012 1:34 PM, "Daniel Brown" <danbrown@xxxxxxx> wrote: > > 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 Crud-- sent to Dan instead of list: Or just let awk do it: tail /var/log/syslog | awk '/sshd/{print($1,$2,$3 "|" $5 "|" $11)}'