Announcement

Collapse
No announcement yet.

Custom file format to compare a server output log

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Custom file format to compare a server output log

    Hello,

    I working on one of the server logs generated by an application at work and I need to compare some changes from the older version with the new version.

    I couldn't figure a way to make BC support those, so I'm creating this post hoping that someone tell me if it is possible, and if it is, how to do it.

    The log format is composed of multiple lines like this:
    [Precise time] - [SENDER IDENTIFIER] - [Num],[timestamp],[MESSAGE IDENTIFIER], message data[\n]

    Example:
    Code:
    20:27:56.992 - PRO1 - 1,73676.385000,POS,10001,1,1,2020-01-31T20:30:14.400;# 0027JU,17.92,-5.24,1.16,0.83,0.00; 00018O,0.38,0.12,1.28,2.05,0.00; 00000W,-11.20,-27.66,6.49,2.34,0.00; 0027X3,-22.38,0.70,0.79,-0.57,0.00; 0000K9,6.72,-9.40,0.14,-0.34,0.00; 002FZW,17.38,4.85,1.05,0.31,0.00; 00259K,-19.35,13.17,0.61,-0.26,0.00; 0027TQ,-5.36,-11.60,1.73,0.10,0.00; 0028NW,1.07,-15.97,0.95,-0.18,0.00; 0026NZ,14.19,15.85,3.68,-0.03,0.00; 000282,46.16,0.04,2.66,-0.84,0.00; 0002HC,-51.90,-0.94,3.98,-0.34,0.00; 0028FJ,-0.40,-10.07,0.67,1.53,0.00; 002FUK,6.42,7.10,1.81,0.74,0.00; 0025AD,13.53,-17.53,3.02,-0.14,0.00; 00277R,-7.45,0.35,1.77,0.01,0.00; 0026QK,-0.48,12.18,0.98,-0.27,0.00; 002FXB,-20.49,-11.21,2.51,1.62,0.00; 0028R0,0.20,-9.27,1.95,3.96,0.00; 0002IG,1.04,22.63,5.44,0.24,0.00; 0000N2,-6.30,20.01,1.35,2.27,0.00; 0028ER,8.67,-0.86,1.20,1.22,0.00;#-1.98,0.07,0.11,0.08,1,1,0.00,0.00;
    I would like a line by line comparison (I did try table mode, but it never aligns the data... Everything is shown as orphan.), where both time strings are marked as non important and everything else is important.
    Optionally I'd like to make "num" not important, but for the first pass that would be an important field as well.

    Is something like that possible? It would greatly speeds things up and improve my accuracy comparing those files manually.
    Unfortunately I can't change the log format.

    Thanks in advance!

  • #2
    The Table Compare is designed for files that use a consistent delimiter between columns, such as comma separated or tab separated values. Your logs don't appear to use a consistent delimiter, so the Table Compare might not work.

    You can try loading your files in the Text Compare, then follow the instructions in the Define Unimportant Text in Beyond Compare article to ignore the time differences using regular expressions.

    Example regular expressions:

    [Precise time]: ^\d{2}:\d{2}:\d{2}\.\d+

    [timestamp]: \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d+

    Explanation of regular expressions:

    ^ - beginning of line
    \d - any decimal character
    {2} - two of the preceding character
    {4} - four of the preceding character
    + - any number of the preceding character
    . - any single character
    \. - \ escapes the . character so it only matches on .

    See also the Regular Expression Reference in Beyond Compare's help file.
    Chris K Scooter Software

    Comment


    • #3
      That helped me quite a lot!
      Thank you!

      Let me use this opportunity to ask something else:

      Sometimes, the events in the log files are out of order.For example: For every update in Provider1, there's 25 updates for Provider2.
      Sometimes Provider2 sends 2 updates in a row, forcing it to be out of order.

      File 1:
      Code:
      P1
      P2 x25
      P1
      P2 x25
      P1
      P2 x25
      File 2:
      Code:
      P1
      P2x25
      P2x25
      P1
      P1
      P1
      P2x25
      (Just to make sure it's clear, x25 is 25 lines of data, in the format I wrote on previous post)

      Is there any possibility for BC to handle this kind of "unimportant difference", or is that too much of a stretch?

      Comment


      • #4
        When comparing these two log files, you would have to sort them with a conversion process. Is there any part of the P1 or P2 lines, like a timestamp, that could be sorted on?

        We have an example KB article on this subject (using resx files as the example) here:
        http://www.scootersoftware.com/suppo...rnalconversion
        Aaron P Scooter Software

        Comment

        Working...
        X