Last active
November 30, 2015 18:24
-
-
Save jamesktan/065985ab784fcf820c1f to your computer and use it in GitHub Desktop.
Script that parses out the Timestamp, URL, and port of an IIS6 Server Log.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
directory = "D:\INFOWEBAPPSLOGS\W3SVC1618619580\\" | |
fileList = os.listdir(directory) | |
for fname in fileList: | |
filePath = directory + fname | |
a = open(filePath) | |
c = a.readlines() | |
for line in c: | |
if ("/secretariat/article.xml.asp") in line: | |
f = open("C:\Users\jtan\OUTPUT.LOG", "a") | |
lineList = line.split(' ') | |
lineNew = " ".join(lineList[0:6]) + "\n" | |
f.write(lineNew) | |
f.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment