log tailing

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

 



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 ssh2

should 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.

--
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