I am new to php and html. Using php, I'm trying to create a script which will search within a text log file and grab data like URL and Overall server status, and if the overall status is Ok it displays the ok in green or if there is a WARN or ERROR, then it has to display the error that is in the next line. Here is the example of the output in text file. I am looking to write a script to display the first line that is the Public URI, then there are different diagnostics run on the server.
For example
Public URL: https://xxxx.xxxx.xxxxx.com:8xxx/xxx
Server version: 6.0
Build id: RJF-I20150519-1056
Overall server status: WARN
Uptime: 6466896664
Cleanup task for unused Services indexes
A set of diagnostics related to the cleanup task for Services indexes
Test completed at Oct 11, 2019 11:02:40 AM
Overall status: OK
System Clock
A diagnostic to ensure that your system clock is accurate compared with the time provided by an NTP provider.
Overall status: WARN
CRJAZ2108W An NTP server is not configured to use for system clock verification. If unsynchronized clocks are on different application servers, problems might occur. To configure the NTP server to be used to verify the accuracy of the system clock, go to the Advanced Properties page, and for the NTP Server Address property, enter the address of an NTP server. To disable this diagnostic, click Disable.
using php I want to display the output to a webpage to look like a table to show the URL and status and color coding the status
$URL= shell_exec( "egrep -ih 'URL|overall status| warn' *.txt" );
echo nl2br ($URL);
and Output is
Public URL: https://xxxx.xxxx.xxxxx.com:8xxx/xxx
Overall server status WARN
Counter Content Service diagnostic OK
License Server Diagnostics OK
Cleanup task for unused Services indexes OK
System Clock WARN
Database Indices OK
is there a way to get the next line of message if a status is WARN and color code it