This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

New to Sophos - Can Sum logviewer be run from a remote computer (like SEC 4.5)?

I am looking to see if it is necessary to log on to the EC server to view the SUM logviewer, or if there is a way to do this from my workstation.

Any/all help GREATLY appreciated.

:9631


This thread was automatically locked due to age.
Parents
  • Hi,

    Here is a little HTA that will enable you to search through the SUM trace logs of a remote machine:

    I haven't spent much time on it so the code is a bit ugly but it should do the job at least for a few weeks.  Note: searching all files without a filter will hang the application for a while depending on the size of the logs and the netowrk speed but I would expect typical usage would be to search for an ide file or something similar.

    To use just paste the following into a text file and save as something like: "SUMTraceLogViewer.HTA"

    <html>
    <head>
    <title>SUM Trace File Log Viewer</title>
    <HTA:APPLICATION SCROLL="Auto" SINGLEINSTANCE="YES" MAXIMIZEBUTTON="yes">
    
    <script Language="VBScript">
    
    const ForReading   = 1
    const TristateUseDefault = -2
    
    dim strToFindString, strToNotFindString, temp
    
    dim FSO : set FSO = createObject("Scripting.FileSystemObject")
        
    Function GetTheFilePath(strToFindStringWithLogs, strLineToFilter, strLineNotToFilter)
        on error resume next
        
        dim LogFilePath, CurrentFolder, Files, MostRecentDateCreated, AreFiles
        
        temp = ""
        strToFindString = strLineToFilter 
        strToNotFindString = strLineNotToFilter
    
        if Document.f1.browse.value <> ""  then
            ReadTheFile Document.f1.browse.value,"0"
            DataArea.InnerHTML = temp
            exit function
        end if
        LogFilePath    = strToFindStringWithLogs & "\"
        err.clear  
        set CurrentFolder = FSO.GetFolder(LogFilePath)
        if err.number > 0 then
            msgbox ("Failed to find SUM log files, please check the path is correct.")
            exit function
        end if
        
        set Files = CurrentFolder.Files
        MostRecentDateCreated = 0
        AreFiles = 0
        if Document.f1.allfiles.Checked  then
            for each OFile In Files
                if instr(OFile.name, ".log") > 0 and instr(OFile.name, "SUMTrace") > 0  then
                    ReadTheFile LogFilePath & OFile.name ,"1"
                end if
            next
        else
            for each OFile In Files
                if instr(OFile.name, ".log") > 0 and instr(OFile.name, "SUMTrace") > 0 then
                    if MostRecentDateCreated = 0 then
                        MostRecentDateCreated = OFile.DateCreated
                        MRCFileName = OFile.Name
                    else
                        if DateDiff("s", OFile.DateCreated, MostRecentDateCreated) < 0 then
                            MRCFileName = OFile.Name
                            MostRecentDateCreated = OFile.DateCreated
                        end if
                    end if
                    AreFiles = 1
                end if
            next
            if AreFiles = 0 then
                FilePathTag.InnerHTML = "No log files in <b>" & LogFilePath & "</b>.  Nothing to display."
                exit Function
            end if
            Set CurrentFolder = nothing
            Set Files = nothing
            ReadTheFile LogFilePath & MRCFileName, "0"
        end if
    
        DataArea.InnerHTML = temp
    
    End Function
    
    Function ReadTheFile(ToOpenFilePath, strALLSet)
    
        on error resume next
    
        dim file, TextStream 'objects
        dim LineArray, TimeArray, FinalArray 'arrays
        dim LineIn, ArrowType, DecID, destinationClipped  'strings
    
        temp = temp & "<hr><span id='filepath' class='filePath'>" & ToOpenFilePath & "</span><hr>" &_
                    "<table class='sample' border='0' cellpadding='2' cellspacing='0' width='100%'>" &_
                    "<th align=""left"">Date\Time</th>" &_
                    "<th align=""left"">Message</th>"
        err.clear 
        set file = FSO.GetFile(ToOpenFilePath)
        if err.number > 0 then
            msgbox ("Failed to find SUM log files in the directory, please check the path.")
            exit function
        end if
        set TextStream = file.OpenAsTextStream(ForReading, TristateUseDefault)
        if Document.f1.highlight.Checked then
            strReplaceHighlight = "<span class='h'>"&strToFindString&"</span>"
        else
            strReplaceHighlight = "<span class='n'>"&strToFindString&"</span>"
        end if
        
        do while not TextStream.AtEndOfStream
            LineIn = TextStream.readline
            if strToNotFindString <> "" then
                if instr(lcase(LineIn),lcase(strToFindString)) > 0 and instr(lcase(LineIn),lcase(strToNotFindString)) = 0 then
                    LineArray = split (LineIn, " : ")
                    if ubound(LineArray) = 0 then
                        temp = temp & "<tr><td></td><td nowrap=""1"">" & replace(LineArray(0),strToFindString, strReplaceHighlight) & "</td></tr>"
                     else
                        ' 0 =  date time 1 = message
                        temp = temp & "<tr><td nowrap=""1"">" & LineArray(0) & "</td>" &_
                        "<td nowrap=""1"">" & replace(LineArray(1),strToFindString, strReplaceHighlight) & "</td></tr>"
                     end if
                end if
            else
                if instr(lcase(LineIn),lcase(strToFindString)) > 0 then
                    LineArray = split (LineIn, " : ")
                    if ubound(LineArray) = 0 then
                        temp = temp & "<tr><td></td><td nowrap=""1"">" & replace(LineArray(0),strToFindString, strReplaceHighlight) & "</td></tr>"
                     else
                        ' 0 =  date time 1 =  Message
                        temp = temp & "<tr><td nowrap=""1"">" & LineArray(0) & "</td>" &_
                            "<td nowrap=""1"">" & replace(LineArray(1),strToFindString, strReplaceHighlight) & "</td></tr>"
                     end if
                end if
            end if
        loop
        temp = temp & "</table>"
        set file = nothing
        set TextStream = nothing
    
    end function
    
    function pathChange()
    
        dim objField, strtemp
        set objField = document.GetElementById("machineNameWithLogs")
        strtemp = lcase(objField.value)
    
        if instr(lcase(strtemp), "programdata") then
            newString = replace (strtemp,"programdata","documents and settings\all users\application data")
            objField.value= newString
        end if
        if instr(lcase(strtemp), "documents and settings") then
            newString = replace (strtemp,"documents and settings\all users\application data","programdata")
            objField.value= newString
        end if
    
        set objField = nothing
    
    end function
    
    </script>
    
    <style type="text/css">
        table.sample td {border-width:1px;padding-left:13px;border-bottom-style:inset;border-color:black;font-size:11px;}
        table.sample th {border-width:0px;padding:2px;border-style:solid;background-color:#eeeeee;}
        input {font-size:10px;}
        p {border-width: 0px;padding:0px;background-color:#dddddd;}
        .filePath{background-color:#dddddd;font-weight:bold;font-size:12px;}
        .h{BACKGROUND-COLOR:yellow;}
        .n{BACKGROUND-COLOR:white;}
    </style>
    
    </head>
    
    <body>
        <form name="f1">
        <table border="0" cellspacing="0">
        <tr>
            <td valign="top">SUM trace log directory:</td>
            <td valign="top">
                <form name="f">
                <input type="text" size="120" name="machineNameWithLogs" value="\\127.0.0.1\C$\Programdata\Sophos\Update Manager\Logs\"><br>
                <font size="-2">Toggle above path to 'ProgramData'\'Documents and settings'</font><input type="checkbox" onclick="pathChange()">
                <font size="-2">Process all SUM Trace logs in directory</font><input type="checkbox" name="allfiles">
                <font size="-2">Highlight matches</font><input type="checkbox" name="highlight" checked="1">
            <td>
        </tr>
        <tr>
            <td>Single SUM trace log:</td><td><input type="file" size="106" name="browse"></td>
        </tr>  
        <tr>
            <td valign="top">Show lines containing:</td>
            <td valign="top">
                <input type="text" name="strToSearchOn" value="" size="40"> but NOT containing: <input  size="40" type="text" name="strToNotSearchOn" value="">
                <input type="button" value="Search log(s)" onclick="GetTheFilePath machineNameWithLogs.value, strToSearchOn.value, strToNotSearchOn.value">
                <input type="button" value="Reset" onclick="location.reload(true)">
            </form></td>
        </tr>
    </table>
    
    <span id="FilePathTag" style="font-size:0.8em;"></span>
    <span id="DataArea"></span>
    <span id="FilePathTagBottomName" style="font-size:0.8em;"></span><br>
    <span id="FilePathTagBottom" style="font-size:0.8em;"></span>
    
    <a name="bottom">
    
    </body>
    </html>

    I hope it's of some use in the short term.  If you have multiple SUMs it might be easier to save a unique copy for each SUM and just hardcode the value of the path in the HTML where it currently reads 127.0.0.1.  E.g.

    SUM1.hta would have \\SUM1\ etc..

    SUM2.hta would have \\SUM2\ etc..

    Which would save typing the name in the string each time.

    Regards,

    Jak

    :9655
Reply
  • Hi,

    Here is a little HTA that will enable you to search through the SUM trace logs of a remote machine:

    I haven't spent much time on it so the code is a bit ugly but it should do the job at least for a few weeks.  Note: searching all files without a filter will hang the application for a while depending on the size of the logs and the netowrk speed but I would expect typical usage would be to search for an ide file or something similar.

    To use just paste the following into a text file and save as something like: "SUMTraceLogViewer.HTA"

    <html>
    <head>
    <title>SUM Trace File Log Viewer</title>
    <HTA:APPLICATION SCROLL="Auto" SINGLEINSTANCE="YES" MAXIMIZEBUTTON="yes">
    
    <script Language="VBScript">
    
    const ForReading   = 1
    const TristateUseDefault = -2
    
    dim strToFindString, strToNotFindString, temp
    
    dim FSO : set FSO = createObject("Scripting.FileSystemObject")
        
    Function GetTheFilePath(strToFindStringWithLogs, strLineToFilter, strLineNotToFilter)
        on error resume next
        
        dim LogFilePath, CurrentFolder, Files, MostRecentDateCreated, AreFiles
        
        temp = ""
        strToFindString = strLineToFilter 
        strToNotFindString = strLineNotToFilter
    
        if Document.f1.browse.value <> ""  then
            ReadTheFile Document.f1.browse.value,"0"
            DataArea.InnerHTML = temp
            exit function
        end if
        LogFilePath    = strToFindStringWithLogs & "\"
        err.clear  
        set CurrentFolder = FSO.GetFolder(LogFilePath)
        if err.number > 0 then
            msgbox ("Failed to find SUM log files, please check the path is correct.")
            exit function
        end if
        
        set Files = CurrentFolder.Files
        MostRecentDateCreated = 0
        AreFiles = 0
        if Document.f1.allfiles.Checked  then
            for each OFile In Files
                if instr(OFile.name, ".log") > 0 and instr(OFile.name, "SUMTrace") > 0  then
                    ReadTheFile LogFilePath & OFile.name ,"1"
                end if
            next
        else
            for each OFile In Files
                if instr(OFile.name, ".log") > 0 and instr(OFile.name, "SUMTrace") > 0 then
                    if MostRecentDateCreated = 0 then
                        MostRecentDateCreated = OFile.DateCreated
                        MRCFileName = OFile.Name
                    else
                        if DateDiff("s", OFile.DateCreated, MostRecentDateCreated) < 0 then
                            MRCFileName = OFile.Name
                            MostRecentDateCreated = OFile.DateCreated
                        end if
                    end if
                    AreFiles = 1
                end if
            next
            if AreFiles = 0 then
                FilePathTag.InnerHTML = "No log files in <b>" & LogFilePath & "</b>.  Nothing to display."
                exit Function
            end if
            Set CurrentFolder = nothing
            Set Files = nothing
            ReadTheFile LogFilePath & MRCFileName, "0"
        end if
    
        DataArea.InnerHTML = temp
    
    End Function
    
    Function ReadTheFile(ToOpenFilePath, strALLSet)
    
        on error resume next
    
        dim file, TextStream 'objects
        dim LineArray, TimeArray, FinalArray 'arrays
        dim LineIn, ArrowType, DecID, destinationClipped  'strings
    
        temp = temp & "<hr><span id='filepath' class='filePath'>" & ToOpenFilePath & "</span><hr>" &_
                    "<table class='sample' border='0' cellpadding='2' cellspacing='0' width='100%'>" &_
                    "<th align=""left"">Date\Time</th>" &_
                    "<th align=""left"">Message</th>"
        err.clear 
        set file = FSO.GetFile(ToOpenFilePath)
        if err.number > 0 then
            msgbox ("Failed to find SUM log files in the directory, please check the path.")
            exit function
        end if
        set TextStream = file.OpenAsTextStream(ForReading, TristateUseDefault)
        if Document.f1.highlight.Checked then
            strReplaceHighlight = "<span class='h'>"&strToFindString&"</span>"
        else
            strReplaceHighlight = "<span class='n'>"&strToFindString&"</span>"
        end if
        
        do while not TextStream.AtEndOfStream
            LineIn = TextStream.readline
            if strToNotFindString <> "" then
                if instr(lcase(LineIn),lcase(strToFindString)) > 0 and instr(lcase(LineIn),lcase(strToNotFindString)) = 0 then
                    LineArray = split (LineIn, " : ")
                    if ubound(LineArray) = 0 then
                        temp = temp & "<tr><td></td><td nowrap=""1"">" & replace(LineArray(0),strToFindString, strReplaceHighlight) & "</td></tr>"
                     else
                        ' 0 =  date time 1 = message
                        temp = temp & "<tr><td nowrap=""1"">" & LineArray(0) & "</td>" &_
                        "<td nowrap=""1"">" & replace(LineArray(1),strToFindString, strReplaceHighlight) & "</td></tr>"
                     end if
                end if
            else
                if instr(lcase(LineIn),lcase(strToFindString)) > 0 then
                    LineArray = split (LineIn, " : ")
                    if ubound(LineArray) = 0 then
                        temp = temp & "<tr><td></td><td nowrap=""1"">" & replace(LineArray(0),strToFindString, strReplaceHighlight) & "</td></tr>"
                     else
                        ' 0 =  date time 1 =  Message
                        temp = temp & "<tr><td nowrap=""1"">" & LineArray(0) & "</td>" &_
                            "<td nowrap=""1"">" & replace(LineArray(1),strToFindString, strReplaceHighlight) & "</td></tr>"
                     end if
                end if
            end if
        loop
        temp = temp & "</table>"
        set file = nothing
        set TextStream = nothing
    
    end function
    
    function pathChange()
    
        dim objField, strtemp
        set objField = document.GetElementById("machineNameWithLogs")
        strtemp = lcase(objField.value)
    
        if instr(lcase(strtemp), "programdata") then
            newString = replace (strtemp,"programdata","documents and settings\all users\application data")
            objField.value= newString
        end if
        if instr(lcase(strtemp), "documents and settings") then
            newString = replace (strtemp,"documents and settings\all users\application data","programdata")
            objField.value= newString
        end if
    
        set objField = nothing
    
    end function
    
    </script>
    
    <style type="text/css">
        table.sample td {border-width:1px;padding-left:13px;border-bottom-style:inset;border-color:black;font-size:11px;}
        table.sample th {border-width:0px;padding:2px;border-style:solid;background-color:#eeeeee;}
        input {font-size:10px;}
        p {border-width: 0px;padding:0px;background-color:#dddddd;}
        .filePath{background-color:#dddddd;font-weight:bold;font-size:12px;}
        .h{BACKGROUND-COLOR:yellow;}
        .n{BACKGROUND-COLOR:white;}
    </style>
    
    </head>
    
    <body>
        <form name="f1">
        <table border="0" cellspacing="0">
        <tr>
            <td valign="top">SUM trace log directory:</td>
            <td valign="top">
                <form name="f">
                <input type="text" size="120" name="machineNameWithLogs" value="\\127.0.0.1\C$\Programdata\Sophos\Update Manager\Logs\"><br>
                <font size="-2">Toggle above path to 'ProgramData'\'Documents and settings'</font><input type="checkbox" onclick="pathChange()">
                <font size="-2">Process all SUM Trace logs in directory</font><input type="checkbox" name="allfiles">
                <font size="-2">Highlight matches</font><input type="checkbox" name="highlight" checked="1">
            <td>
        </tr>
        <tr>
            <td>Single SUM trace log:</td><td><input type="file" size="106" name="browse"></td>
        </tr>  
        <tr>
            <td valign="top">Show lines containing:</td>
            <td valign="top">
                <input type="text" name="strToSearchOn" value="" size="40"> but NOT containing: <input  size="40" type="text" name="strToNotSearchOn" value="">
                <input type="button" value="Search log(s)" onclick="GetTheFilePath machineNameWithLogs.value, strToSearchOn.value, strToNotSearchOn.value">
                <input type="button" value="Reset" onclick="location.reload(true)">
            </form></td>
        </tr>
    </table>
    
    <span id="FilePathTag" style="font-size:0.8em;"></span>
    <span id="DataArea"></span>
    <span id="FilePathTagBottomName" style="font-size:0.8em;"></span><br>
    <span id="FilePathTagBottom" style="font-size:0.8em;"></span>
    
    <a name="bottom">
    
    </body>
    </html>

    I hope it's of some use in the short term.  If you have multiple SUMs it might be easier to save a unique copy for each SUM and just hardcode the value of the path in the HTML where it currently reads 127.0.0.1.  E.g.

    SUM1.hta would have \\SUM1\ etc..

    SUM2.hta would have \\SUM2\ etc..

    Which would save typing the name in the string each time.

    Regards,

    Jak

    :9655
Children
No Data