Answer the question
In order to leave comments, you need to log in
In the received lines, display only numbers?
Line: [27/Apr/2020:19:14:17 +0000] GET https://domain/api/lead/0/43927/0/0 pid:28254 took:0.171s mem:8mb cpu:58.62% status :200 {54.227.122.223|Zapier}
Regular:
$regex = '/(^\[(?<datetime>.*)\]) (?P<method>OPTIONS|GET|HEAD|POST|PUT|DELETE|TRACE|CONNECT|PATCH|PROPFIND) (?P<url>.+?\S) (?P<pid>.+?\S) (?P<took>.+?\S) (?P<mem>.+?\S) (?P<cpu>.+?\S) (?P<status>.+?\S+)/';
Array
(
[0] => [27/Apr/2020:19:14:17 +0000] GET https://domain/api/lead/0/43927/0/0 pid:28254 took:0.171s mem:8mb cpu:58.62% status:200
[1] => [27/Apr/2020:19:14:17 +0000]
[datetime] => 27/Apr/2020:19:14:17 +0000
[2] => 27/Apr/2020:19:14:17 +0000
[method] => GET
[3] => GET
[url] => https://domain/api/lead/0/43927/0/0
[4] => https://domain/api/lead/0/43927/0/0
[pid] => pid:28254
[5] => pid:28254
[took] => took:0.171s
[6] => took:0.171s
[mem] => mem:8mb
[7] => mem:8mb
[cpu] => cpu:58.62%
[8] => cpu:58.62%
[status] => status:200
[9] => status:200
)
['pid' => 28254, 'cpu' => 58.62]
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question