Home > Backend Development > PHP Tutorial > PHP正则解析|提取|过滤标准的syslog日记文件内容

PHP正则解析|提取|过滤标准的syslog日记文件内容

WBOY
Release: 2016-06-13 12:30:35
Original
986 people have browsed it

PHP正则解析|提取|过滤标准的syslog日志文件内容
日志内容:
Dec 30 15:10:48 root my: 192.168.1.51 test 退出邮件管理系统
Dec 30 15:11:23 root my: 192.168.1.51 stella 退出邮件管理系统
...
通过正则逐行提取有用信息,并返回数组
...
解析后:
array(
 [0]=>array(
    [0]=>Dec 30 15:10:48,
    [1]=>root,
    [2]=>my,
    [3]=>192.168.1.51,
    [4]=>test,
    [5]=>退出邮件管理系统
  ),
 [1]=>array(
    [0]=>Dec 30 15:11:23,
    [1]=>root,
    [2]=>my,
    [3]=>192.168.1.51,
    [4]=>stella ,
    [5]=>退出邮件管理系统
  ),
);

求,解析过程

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template