I want to perform some log analyses. Example log file listed below. I know how to resolve this issue with procedure/script, but I wonder how it can be done in 'powershell style' with pipelines etc
Log file contains from string with filename and list of components. Each of them can be 'passed' or 'failed'. I want to print all lines starting with 'Checking' which has at least one FAILED component.
Checking : C:\TFS\Datavarehus\Main\ETL\SSIS\DVH Project\APL_STG1_Daglig_Master.dtsx
Checking : C:\TFS\Datavarehus\Main\ETL\SSIS\DVH Project\COPY_STG1_APL_Dekningsgrupper_Z1.dtsx
SQLCommand [Z1 APL_Dekningsgrupper] FAILED the VA1 check (table name as source)
SQLCommand [APL_Dekningsgrupper] passed the VA1 check
SQLCommand [FAK_Avkastningsgaranti_Kollektiv] FAILED the VA1 check (table name as source)
Checking : C:\TFS\Datavarehus\Main\ETL\SSIS\DVH Project\DM_DVH_BpBedrift_InvesterteFond 1.dtsx
SQLCommand [DVH] passed the VA1 check
SQLCommand [Avtale Kurs] passed the VA1 check
At the glance looks like I need something similar to
gc logtxt | select-string -pattern 'FAILED' -context <nearest line starting with "Checking" in begining direction>,<lines count from CheckingLine to "LineWith 'FAILED'">