Search through lots of log files

Home Forums CodeSite Search through lots of log files

Viewing 10 reply threads
  • Author
    Posts
    • #1658
      Hans Brand
      Participant

        Hi all,

        Recently received a lot (300+) CodeSite log files of about 1M each.

        Now I need to find out if there are any warning messages in these files.

        Opening these files one by one and searching for warning messages turns out a very tedious job.

        Is there a quicker way to do this?

        Kind regards,
        Hans Brand

      • #1660
        Ray Konopka
        Keymaster

          Hi Hans,

          At first I was going to suggest the CSMergeFiles tool to combine all your logs into one (or a few) log files, but then I realized that the CSMergeFiles tools works by taking two log files and creating a merged log file. Combining 300+ log files would be nearly as tedious as loading each one into the viewer.

          This gave me an idea–a new command line tool called CSSearchFiles where you specify a log filename or a wildcard along with what types of messages you are looking for (e.g. Warnings, Errors, Exceptions, Notes) and the tools rips through each of the log files that match the file mask and writes on the console any matches including the message number. Then load the corresponding log file into the viewer and select Search > Jump to Message and enter the message number from the output.

          The tool is working, but I need to do a little bit more to polish it up. I’ll make the tool available in the next day or two. Here’s a screenshot of the current version.

          Ray

          CSSearchFiles.png

          • This reply was modified 4 years, 8 months ago by Ray Konopka.
        • #1662
          Hans Brand
          Participant

            Hello Ray,

            Thank you for picking this up so quickly.

            Just a list with files containing any warning messages is actually already very helpful to me. Most of the files do not have any warnings in them. I’ll wait for your tool.

            Greetings,
            Hans

          • #1663
            David Hoyle
            Participant

              Ray,

              That would be a very useful tool as I create CSL log files for different days and this would make it very easy to find messages within a whole collection of them.

              regards

              Dave.

            • #1667
              Ray Konopka
              Keymaster

                Hi,

                The new CSSearchFiles command line tool is now available:
                https://raize.com/wp-content/uploads/CSSearchFiles.zip

                The usage information for CSSearchFiles is shown below. Running CSSearchFile.exe without any command line parameters will also display the usage information.

                Remember that the message number displayed next to each match can be used to jump directly to that message while in the CodeSite Live Viewer or CodeSite File Viewer.

                Ray

                CodeSite Search Files 5.3.3
                Copyright (c) 1998-2018 by Raize Software, Inc.  All Rights Reserved.
                
                Usage:
                  CSSearchFiles [-type:<MsgTypes>] [-text:<Text>] [-trim:<Columns>] <Files>
                
                  MsgTypes:  Search for specified message types (e.g. EX)
                             N=Notes | W=Warnings | E=Errors | X=Exceptions
                
                  Text:      If search text includes spaces, wrap in double quotes
                  Columns:   Trim output to column width (e.g. 80)
                  Files:     Path to CodeSite file(s) to search (e.g. C:\Logs\*.csl)
                
                Examples:
                
                CSSearchFiles -type:EX *.csl
                  Search for all Error and Exception messages in all CodeSite log files
                  in the current directory
                
                CSSearchFiles -text:"Print Report" *.csl
                    Search for all messages that contain "Print Report" in message text
              • #1683
                Hans Brand
                Participant

                  Thanks Ray!

                  Your tool did exactly what I needed it to do! It found that only two *.csl files of the 300+ actually had a warning in it, using this single command:

                  CSSearchFiles.exe -type:W *feb25*.csl
                  CodeSite Search Files 5.3.3
                  Copyright (c) 1998-2018 by Raize Software, Inc. All Rights Reserved.

                  LaserToolLog2020Feb25_1324_0056.csl
                  2054 Warning Timeout waiting for BQ_LOW

                  LaserToolLog2020Feb25_1324_0138.csl
                  3915 Warning Timeout waiting for BQ_LOW

                  Greetings, Hans Brand

                   

                • #1685
                  Ray Konopka
                  Keymaster

                    Hi Hans,

                    I’m so glad to hear that the CSSearchFiles tool helped you locate what you were looking for more quickly. And thank you for bringing up your request on this forum. I love to hear how people are using (or would like to use) CodeSite. You never know when it may spark a new feature or supporting tool!

                    Ray

                  • #1893
                    Hans Brand
                    Participant

                      Dear Ray,

                      I am still using the CSSearchFiles tool with much success, thanks.

                      I have one request, though.
                      Would it be possible to do recursive searches down into sub-directories?
                      I have gathered a lot of logging files into more than 60 sub-folders (different levels deep) and want to quickly see if any event ever occurred in any of these log files. By the way, all my log files have the .csl extension.

                      Also noticed that the CSSearchFiles is not in the 5.3.4 distribution with C++ Builder?

                      Kind regards and stay healthy,

                      Hans Brand

                       

                    • #1958
                      Ray Konopka
                      Keymaster

                        Hi Hans,

                        Yes, it would certainly be possible to add a -S option to support searching into sub-directories. Things are a little hectic right now, so I may not be able to get to it soon, but I’ve added it to our feature requests.

                        Thanks for letting me know about the deployment. The CSSearchFile.exe was included in the CodeSite Studio 5.3.4 release, but not for the Express Edition. We’ll consider including it in the future.

                        Ray

                      • #2111
                        Hans Brand
                        Participant

                          Dear Ray,

                          Hope you are still in good health?

                          I would like to add another request for the CSSearchFile.exe program.
                          It would really help me when the “Date” and “Time Stamp” columns were included in the output.

                          Kind regards,
                          Hans Brand

                           

                        • #2120
                          Ray Konopka
                          Keymaster

                            Hi Hans,
                            I’ll add that request to the enhancement list.

                            Ray

                        Viewing 10 reply threads
                        • You must be logged in to reply to this topic.