EQLogParser: Is there an easy way to split log files?

Discussion in 'The Veterans' Lounge' started by Windance, Jul 24, 2022.

  1. Windance Augur

    "EQ Log Parser" is an amazing tool. I've been using it for a few months now and I'm still finding new things.

    I would like to look at the curse caller and aten ha over specific HP ranges. Specifically looking at the phases where there are no adds up. I have placed markers in the log files via saying something in chat.

    Currently I'm using notepad++ and its fairly tedious. I could write a fairly simple program but it seems like there is should be several tools already out there to do the job.
  2. Bigstomp Augur

    I don't believe there is any log message which tells you what hp% a mob is at.
    It would be very useful for triggers if there was.
    Angahran likes this.
  3. kizant Augur

  4. Windance Augur

    I know the time / HP because I recorded the fight using OBS ( wonderful tool ) and now I want to focus in on what the tanks are doing DPS when there are no adds up.

    Currently I load the log into excel, strip out the part I want to look at and save it back out to a text file.

    Since I'm going to be doing this kind of analysis multiple times I'll likely just make an excel macro, but, EQ Log Parser has many hidden gems, and might be able to do what I want ... so I'm asking.
  5. Soulbanshee Augur

    How about PowerShell? Set the MarkerIn between the quotes to what you say when you want to start the split, and the MarkerOut between the quotes to what you say when you want to end the split. This will build a resulting log file starting after your marker text and ending before your closing text. Set the paths to where your log file in is, and where you want to save the result out to (name it differently because it will overwrite). You can then load the result file into a parser.

    Code:
    $Content = Get-Content -Path 'C:\path\to\log.txt'
     
    $Result = @()
     
    $Marker = $false
     
    $MarkerIn = 'Marker Started'
     
    $MarkerOut = 'Marker Ended'
     
     
    ForEach ($Line in $Content) {
     
    if ($Line -match $MarkerOut) { $Marker = $false }
     
     
    if ($Marker) { $Result += $Line }
     
     
    if ($Line -match $MarkerIn) { $Marker = $true }
     
    }
     
     
    $Result | Out-File -FilePath 'C:\path\to\save\result.txt' -Encoding ascii -Force
  6. Moege Augur

    Powershell script, change the first 3 lines to what you need, It cuts between marker ---to-- marker then write it to the outname1.txt outname2.txt etc. Takes about 5 seconds for a 600MB file.

    Save as cut.ps1 or whatever you want just need the ps1 extension
    Code:
    $logname = "C:\EQ\mycharname.txt"
    $outname = "C:\cutlog"
    $marker = "aaaaa aaaaaa"
    # -------------------
    # do not modify below
    # -------------------
    $log = 0
    $cut = 0
    $tmp = $outname
     
    Get-Content $logname | ForEach-Object {
        if ($_ -contains "$marker") {
            if ($log -eq 0) {
                $log = 1
                $cut = $cut+1
                $tmp = "$outname"+$cut+".txt"
                New-Item -Path "$tmp" -ItemType File -Force
            } else {
                $log = 0
            }
        } elseif ($log -eq 1) {
            $_ | out-file -FilePath "$tmp" -Append
        }
    }
    Or if you want all the lines between the markers in a single file
    Code:
    $logname = "C:\EverQuest F2P\Logs\eqlog_xxxx_yyyy.txt"
    $outname = "C:\cutlog.txt"
    $marker = "aaaaa aaaaaa"
     
    # -------------------
    # do not modify below
    # -------------------
    $log = 0
     
    New-Item -Path "$outname" -ItemType File -Force
    foreach($line in [System.IO.File]::ReadLines("$logname")) {
        if ($line -contains "$marker") {
            if ($log -eq 0) {
                $log = 1
            } else {
                $log = 0
            }
        } elseif ($log -eq 1) {
            $line | out-file -FilePath "$outname" -Append
        }
    }
    
    Temporary solution until eqlogparser gets changed(maybe).

    Anyway you get the idea :p modify as you want.
    PS. I looked for a tool to do it with, could not find one
  7. Soulbanshee Augur

    Very C# of you. I went for a totally in-memory solution because it doesn't really make sense to keep opening a file handle to append in a loop. The default encoding for Out-File is UTF-16 little-endian byte order, wasnt sure if that was compatible with the parsing programs so I set -Encoding ascii which will be UTF-8 no BOM like EQ outputs (-Encoding utf8 is utf8-BOM funnily). One last note, -contains is really meant for lists though it will iterate over strings and I forget if its regexy which could cause issues with regex special characters. String comparison you can do as .NET $_.Contains($marker).