将应用程序日志转发到Windows事件日志
答
你的意思是事件源? PowerShell的将是 则New-EventLog命令发现这里提供的更详细的编辑后
。
你想要什么的基本原理是查询日志文件并将找到的行写入事件日志。这就好比做如下:
#Get the content of the error log, gets the top 10 lines ONLY!!
$GetLog = Get-Content -Path D:\Errorlog.txt -totalcount 10
#Now take the data found and write it to the event log under the source and log below
Write-EventLog -LogName "Application" -Source "My Application" -Eventid 1001
-EntryType Error -Message "$Getlog" -Category 1
我需要显示在事件日志窗口中的应用 myapplication.log --->应用程序事件日志窗口 –
,我收到你现在的日志。我认为这是可能的....承担我 –
谢谢理查德,但我怎么能够实时做到这一点 –