Develop Small PowerShell Script to Parse Log Files
$10-30 USD
ที่ทำเสร็จแล้ว
โพสต์ มากกว่า 5 ปีที่ผ่านมา
$10-30 USD
ชำระเงินเมื่อส่งงาน
Looking for someone to create a PowerShell script which loops through all XML log files in a defined directory. If the filename contains “request” and the RequestCommand is “GetSessions” then extract the data for the tags defined below and insert the values into a SQL table. Looking for someone that could complete this today. I will provide example log files to work with.
LogDirectory = C:\Logs
ProcessedLogDirectory= LogDirectory\Processed
SQLServer = localhost
Logic
1.) Loop through all XML log files in the LogDirectory (do not include sub-directories)
2.) If the filename contains "request" then proceed with processing. If not, move the file to ProcessedLogDirectory.
3.) If the file contains <RequestCommand>GetSessions</RequestCommand> then proceed with processing. Else move the file to the ProcessedLogDirectory.
4.) Extract the following values and insert them into the database:
a. RequestID
b. GatewayHostname
c. GatewayPort
d. GatewayUsername
e. DestinationHostnames
f. DestinationUsername
g. RequestUsername
h. ClientIP
Log Example:
<RequestID>892c08a2-7859-40d3-b971-03e91050eb1e</RequestID>
<GatewayHostname>[login to view URL]</GatewayHostname>
<GatewayPort>4587</GatewayPort>
<GatewayUsername>AD\aj</GatewayUsername>
<DestinationHostnames>[login to view URL]</DestinationHostnames>
<DestinationUsername>user@[login to view URL]</DestinationUsername>