@echo off setlocal enabledelayedexpansion REM Define variables for log monitoring set…
Jump to turn (7)
- 1@echo off setlocal enabledelayedexpansion REM Define variables for log monitorin
- 2i mean both "start" and "keywork" or "end" and "keyword"
- 3make it in condition keyword and start or end
- 4@echo off setlocal enabledelayedexpansion REM Define variables for log monitorin
- 5no display the line not in keyword
- 6only both start and keyword or end keyword
- 7it display red line when only start, i need display red for is in codition (both
- User
@echo off setlocal enabledelayedexpansion
REM Define variables for log monitoring set "KEYWORDS_FILE=%~dp0keywords.txt" REM Assuming keywords.txt is in the same directory as the script
:: Monitor remote log file with PowerShell cls & echo Waiting for Log...
:: Starting plink to SSH into the remote server and tail the log file, sending output to PowerShell plink -ssh -pw 12345678 noname@localhost "tail -f log.log" | powershell -NoProfile -ExecutionPolicy Bypass -Command ^ "_ -match '\S' }; " ^ "true) { " ^ " null -eq line)) { continue; } " ^ " line; " ^ " keywords | Where-Object { _ }; " ^ " if (line -ForegroundColor Red; " ^ " } else { " ^ " Write-Host $line; " ^ " } " ^ "}"