Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

parsing log files using a batch file

$
0
0

i have a log on script

rem The following line creates a rolling log file of usage by workstation 
echo "Log In","%Date%","%TIME%","%USERNAME%" >> \\imsnas03\Active-Directory-Logs\logs\computer\%COMPUTERNAME%.txt

rem The following line creates a rolling log file of usage by user 
echo "Log In","%Date%","%TIME%","%COMPUTERNAME%" >> \\imsnas03\Active-Directory-Logs\logs\user\%USERNAME%.txt

i want to make it parse logs by month and year for example

to put the log file in a folder called january in a folder called 2013

\\imsnas03\Active-Directory-Logs\logs\user\2013\january\%USERNAME%.txt

 \\imsnas03\Active-Directory-Logs\logs\computer\2013\january\%COMPUTERNAME%.txt

what do i add to the batch file to make it parse the log files like that

the output in the current logfiles look like this

from the user folder

"Log In","Tue 01/08/2013"," 9:35:12.17","INSPIRONLAPTOP1"

and like this from the computer folder

"Log In","Tue 01/08/2013"," 9:35:12.06","test12"

basically i want it to create a folder for each year and month and put the file in the correct folders


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>