<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic SARG on Windows in Web Security</title>
    <link>https://community.cisco.com/t5/web-security/sarg-on-windows/m-p/1342046#M952</link>
    <description>&lt;P&gt;I have noticed some quirkiness with SARG on windows and the ironport squid log file format (with regards to username).  I've created a vbscript to resolve the issue and thought I'd post if for others.  The script also generates the logs based on days, parsed from the source ironport logs.&lt;BR /&gt;&lt;BR /&gt;Btw, I have to use windows so don't ask &lt;span class="lia-unicode-emoji" title=":grinning_face_with_big_eyes:"&gt;😃&lt;/span&gt;&lt;BR /&gt;Also, not sure how well it will work on large log files...  &lt;BR /&gt;&lt;BR /&gt;' Description:	Parses Ironport WSA squid access log files &lt;BR /&gt;'				and produces daily log output suitible for &lt;BR /&gt;'				SARG on MS Windows&lt;BR /&gt;'				Warning: Script removes original log files&lt;BR /&gt;'				Example: parselogs.vbs d:\ftproot d:\proxylogs&lt;BR /&gt;Option Explicit&lt;BR /&gt;&lt;BR /&gt;testInput&lt;BR /&gt;&lt;BR /&gt;Dim objRegExpr, objFSO, objFile, objInputFile, objOutputFile, objFolder&lt;BR /&gt;Dim strSourceDir, strDestinationDir, colFiles, strInputFile, strOutputFile&lt;BR /&gt;&lt;BR /&gt;Const ForReading = 1, ForWriting = 2, ForAppending = 8&lt;BR /&gt;&lt;BR /&gt;Set objFSO = CreateObject("Scripting.FileSystemObject")&lt;BR /&gt;Set objRegExpr = New RegExp&lt;BR /&gt;&lt;BR /&gt;objRegExpr.Global = True&lt;BR /&gt;objRegExpr.IgnoreCase = False&lt;BR /&gt;strSourceDir = WScript.Arguments.Item(0)&lt;BR /&gt;strDestinationDir = WScript.Arguments.Item(1)&lt;BR /&gt;&lt;BR /&gt;If objFSO.FolderExists(strSourceDir) AND objFSO.FolderExists(strDestinationDir) Then&lt;BR /&gt;	Set objFolder = objFSO.GetFolder(strSourceDir)&lt;BR /&gt;	Set colFiles = objFolder.Files&lt;BR /&gt;	For Each objFile in colFiles&lt;BR /&gt;		strInputFile = strSourceDir &amp;amp; "\" &amp;amp; objFile.Name&lt;BR /&gt;		objRegExpr.Pattern = ".*@(\d{8})T.*"&lt;BR /&gt;		strOutputFile = strDestinationDir &amp;amp; "\" &amp;amp; objRegExpr.Replace(objFile.Name, "$1") &amp;amp; ".log"&lt;BR /&gt;		Set objInputFile = objFSO.OpenTextFile(strInputFile, ForReading)&lt;BR /&gt;		Set objOutputFile = objFSO.OpenTextFile(strOutputFile, ForAppending, True)&lt;BR /&gt;		objRegExpr.Pattern = " ""(.*)@.*"" "&lt;BR /&gt;		Do While Not objInputFile.AtEndOfStream&lt;BR /&gt;			objOutputFile.WriteLine(objRegExpr.Replace(objInputFile.ReadLine, " $1 "))&lt;BR /&gt;		Loop&lt;BR /&gt;		objInputFile.Close&lt;BR /&gt;		objOutputFile.Close&lt;BR /&gt;		objFSO.DeleteFile(strInputFile)&lt;BR /&gt;	Next&lt;BR /&gt;Else&lt;BR /&gt;	Wscript.Echo "Error: Invalid Source or Destination Directory"&lt;BR /&gt;	Wscript.Quit&lt;BR /&gt;End If&lt;BR /&gt;&lt;BR /&gt;Sub testInput()&lt;BR /&gt;	If WScript.Arguments.Count &amp;lt; 2 then&lt;BR /&gt;		Wscript.Echo "Usage: " &amp;amp; Wscript.ScriptName &amp;amp; " &amp;lt;sourcedir&amp;gt; &amp;lt;destinationdir&amp;gt;"&lt;BR /&gt;		Wscript.Quit&lt;BR /&gt;	End If&lt;BR /&gt;End Sub&lt;/P&gt;</description>
    <pubDate>Sun, 01 Nov 2009 13:42:21 GMT</pubDate>
    <dc:creator>droth_ironport</dc:creator>
    <dc:date>2009-11-01T13:42:21Z</dc:date>
    <item>
      <title>SARG on Windows</title>
      <link>https://community.cisco.com/t5/web-security/sarg-on-windows/m-p/1342046#M952</link>
      <description>&lt;P&gt;I have noticed some quirkiness with SARG on windows and the ironport squid log file format (with regards to username).  I've created a vbscript to resolve the issue and thought I'd post if for others.  The script also generates the logs based on days, parsed from the source ironport logs.&lt;BR /&gt;&lt;BR /&gt;Btw, I have to use windows so don't ask &lt;span class="lia-unicode-emoji" title=":grinning_face_with_big_eyes:"&gt;😃&lt;/span&gt;&lt;BR /&gt;Also, not sure how well it will work on large log files...  &lt;BR /&gt;&lt;BR /&gt;' Description:	Parses Ironport WSA squid access log files &lt;BR /&gt;'				and produces daily log output suitible for &lt;BR /&gt;'				SARG on MS Windows&lt;BR /&gt;'				Warning: Script removes original log files&lt;BR /&gt;'				Example: parselogs.vbs d:\ftproot d:\proxylogs&lt;BR /&gt;Option Explicit&lt;BR /&gt;&lt;BR /&gt;testInput&lt;BR /&gt;&lt;BR /&gt;Dim objRegExpr, objFSO, objFile, objInputFile, objOutputFile, objFolder&lt;BR /&gt;Dim strSourceDir, strDestinationDir, colFiles, strInputFile, strOutputFile&lt;BR /&gt;&lt;BR /&gt;Const ForReading = 1, ForWriting = 2, ForAppending = 8&lt;BR /&gt;&lt;BR /&gt;Set objFSO = CreateObject("Scripting.FileSystemObject")&lt;BR /&gt;Set objRegExpr = New RegExp&lt;BR /&gt;&lt;BR /&gt;objRegExpr.Global = True&lt;BR /&gt;objRegExpr.IgnoreCase = False&lt;BR /&gt;strSourceDir = WScript.Arguments.Item(0)&lt;BR /&gt;strDestinationDir = WScript.Arguments.Item(1)&lt;BR /&gt;&lt;BR /&gt;If objFSO.FolderExists(strSourceDir) AND objFSO.FolderExists(strDestinationDir) Then&lt;BR /&gt;	Set objFolder = objFSO.GetFolder(strSourceDir)&lt;BR /&gt;	Set colFiles = objFolder.Files&lt;BR /&gt;	For Each objFile in colFiles&lt;BR /&gt;		strInputFile = strSourceDir &amp;amp; "\" &amp;amp; objFile.Name&lt;BR /&gt;		objRegExpr.Pattern = ".*@(\d{8})T.*"&lt;BR /&gt;		strOutputFile = strDestinationDir &amp;amp; "\" &amp;amp; objRegExpr.Replace(objFile.Name, "$1") &amp;amp; ".log"&lt;BR /&gt;		Set objInputFile = objFSO.OpenTextFile(strInputFile, ForReading)&lt;BR /&gt;		Set objOutputFile = objFSO.OpenTextFile(strOutputFile, ForAppending, True)&lt;BR /&gt;		objRegExpr.Pattern = " ""(.*)@.*"" "&lt;BR /&gt;		Do While Not objInputFile.AtEndOfStream&lt;BR /&gt;			objOutputFile.WriteLine(objRegExpr.Replace(objInputFile.ReadLine, " $1 "))&lt;BR /&gt;		Loop&lt;BR /&gt;		objInputFile.Close&lt;BR /&gt;		objOutputFile.Close&lt;BR /&gt;		objFSO.DeleteFile(strInputFile)&lt;BR /&gt;	Next&lt;BR /&gt;Else&lt;BR /&gt;	Wscript.Echo "Error: Invalid Source or Destination Directory"&lt;BR /&gt;	Wscript.Quit&lt;BR /&gt;End If&lt;BR /&gt;&lt;BR /&gt;Sub testInput()&lt;BR /&gt;	If WScript.Arguments.Count &amp;lt; 2 then&lt;BR /&gt;		Wscript.Echo "Usage: " &amp;amp; Wscript.ScriptName &amp;amp; " &amp;lt;sourcedir&amp;gt; &amp;lt;destinationdir&amp;gt;"&lt;BR /&gt;		Wscript.Quit&lt;BR /&gt;	End If&lt;BR /&gt;End Sub&lt;/P&gt;</description>
      <pubDate>Sun, 01 Nov 2009 13:42:21 GMT</pubDate>
      <guid>https://community.cisco.com/t5/web-security/sarg-on-windows/m-p/1342046#M952</guid>
      <dc:creator>droth_ironport</dc:creator>
      <dc:date>2009-11-01T13:42:21Z</dc:date>
    </item>
  </channel>
</rss>

