PHP extracts a certain content in the log

$file_dir = "log path"; 
$info = shell_exec("grep -e '".$keyword."' ".$file_dir); 
$ret = explode(PHP_EOL,$info);

It probably means to find the matching log content through the grep command in linux, grep -e 'keyword' will return all lines containing keywords in the log

Then process the data according to your own business needs

Guess you like

Origin blog.csdn.net/echozly/article/details/122683319