log tailing
| From: | Mihamina Rakotomandimby | Date: | Fri, 29 Jun 2012 08:49:11 +0000 |
| Subject: | log tailing | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-318341@lists.php.net to get a copy of this message | ||
Hi all,
I have a /var/log/messages and /var/log/syslog file to parse to extract information from.
It's mainly to insert the data to several SQL tables.
I have the to extract the date, and some information in the line.
Doing it with preg_match() and extracting the data is the first solution comming to my mind.
Typically, a log line like:
Jun 29 11:24:10 dev5 sshd[12775]: Accepted password \
for dev5 from 192.168.0.12 port 50544 ssh2should drive me to extract to $out[] like: - $out[0] is "Jun 29 11:24:10" - $out[1] is "sshd" - $out[3] is "192.168.0.12" So that I can: INSERT INTO ssh_activity \ VALUES ('2012-06-29 11:24:10', '192.168.0.12') I just need help on the right regexp function to use. Would you know some PHP/regexp tutorials for that? -- RMA.