Log Management Socials (How To) [Updated 9/2/2021]

Discussion in 'The Veterans' Lounge' started by MasterMagnus, Sep 1, 2021.

  1. MasterMagnus The Oracle of AllHigh

    This is intended to give an easy way to set up buttons in EQ to do simple log file management. Using the in-game command /system, and batch files.

    0. Intro and links to each section. The Master's Manual
    1. The log management suite. Social Buttons to rule them all!
    2. Back Log. Mages wanna duplicate.
    3. Snap Log. Monk made a funny.
    4. Delete all logs on demand. Me Smash Logs!
    5. Scheduled Backup and Deletion. Wizards do it on schedule.
    6. The Minutia. For Gnomes.
    ---------------------------------------

    Please Note:
    Most of these require the use of the /system EQ command.

    To see if you have this enabled or not, in a chat box type: /system notathing

    You may see a quickly flashing window open and close, then EQ will say "Executed notathing". OR it will give the following message.
    I think it's important for me to show you this message in case you've never seen it for yourself.
    If you see this message, and want to follow any of the 'batch-file-from-EQ' button methods you must follow the directions above and edit your eqclient.ini file (which can be edited in notepad).

    First Step: EnableSystemCommand=1 in your eqclient.ini

    Second Step: Create a new folder in your \Everquest\ folder named "logfiles". So now you have Everquest\logfiles\ (keep it lower case, whereas all the EQ made folders are upper case).

    The various methods below can be used 'a la carte', if you want to use most of them, you will create a text file in the Everquest\logfiles\ folder and rename it as a batch file. Then create a button in EQ to trigger that batch file.
  2. MasterMagnus The Oracle of AllHigh

    1. The log management suite. Social Buttons to rule them all!
    the first two buttons here (log on and off) use only in-game commands and need no batch files or /system commands.

    [IMG]

    Log ON EQ macro
    Code:
    /pause 9,/loginterval 1
    /log on
    Log OFF EQ macro
    Code:
    /log off
    Back Log and Snap Log use batch files and are detailed separately below.
  3. MasterMagnus The Oracle of AllHigh

    2. Back Log. Mages wanna duplicate.
    This will backup your character's log file in Everquest\logfiles\, with a Date-Name_server.txt filename and give you the option to delete it from Everquest\Logs\ source, giving you a fresh log file.

    note: this turns off the log before copying and does not turn it back on. Click the Log ON button after using.

    -Create a new text file in the Everquest\logfiles\ folder.
    -Copy and paste the code below into the file.
    backlog.bat (updated 9/2/2021-7:00am with better error checking)
    Code:
    @echo off
    echo.
    echo Welcome %1
    echo.
    echo F|xcopy /j /q /y /v .\Logs\eqlog_%1.txt .\logfiles\%date:~-4,4%-%date:~-10,2%-%date:~-7,2%-%1.txt
    if errorlevel 5 goto diskerr
    if errorlevel 4 goto lowmem
    echo.
    echo %1 Log File backed up.
    echo.
    echo DELETE %1 Log File in main Logs folder?
    echo.
    del /p ".\Logs\eqlog_%1.txt"
    goto exit
    :diskerr
    echo Disk Error reported FILE MAY NOT HAVE BACKED UP.
    goto nodel
    :lowmem
    echo Low Memory reported FILE WAS NOT BACKED UP.
    echo Your available memory is low, try freeing up some space.
    :nodel
    echo Exiting without deleting source file.
    pause
    :exit
    
    -Rename the file: backlog.bat
    -Inside EQ Create a macro with this code, replacing Name_server with your character name and server as it appears in the Everquest\Logs\ folder. Check there to get it right, some but not all server names are abbreviated.
    Back Log EQ macro
    Code:
    /pause 9,/log off
    /system .\logfiles\backlog.bat Name_server
    
    Bienbonita likes this.
  4. MasterMagnus The Oracle of AllHigh

    3. Snap Log. Monk made a funny.
    This makes a copy of the current character's log with a Date-Time-Name_server.txt filename, and that's it.

    If someone says something you want to capture, that awesome joke, whatever. Hit the Snap Log.

    Be aware if you have an enormous file that hasn't been cleared for a long time, it will all be copied. But that thing you wanted to grab will be near the end of the file. I wouldn't use this if you're an 'always on' log person.

    -Create a new file in the Everquest\logfiles\ folder.
    -Copy and paste the below code into the file.
    snaplog.bat
    Code:
    echo F|xcopy /q /y .\Logs\eqlog_%1.txt .\logfiles\%date:~-4,4%-%date:~-10,2%-%date:~-7,2%-%time:~-11,2%-%time:~-8,2%-%time:~-5,2%-%1.txt
    -Rename the file: snaplog.bat
    -In EQ create a macro, replacing Name_server with your character name and server as it appears in the Everquest\Logs\ folder. Check there to get it right, some but not all server names are abbreviated.
    Snap Log EQ macro (not good for large and 'always on' files see below)
    Code:
    /pause 9,/log off
    /pause 12,/system .\logfiles\snaplog.bat Name_server
    /pause 9,/loginterval 1
    /log on
    -If you are using this with large log files remove the last two lines of that macro (/pause9,...and /log on) and turn your log file back on manually after use.
  5. MasterMagnus The Oracle of AllHigh

    4. Delete ALL LOGS on demand. Me Smash Logs!
    Some ogres just gotta smash?

    -Create a text file in the Everquest\logfiles\ folder.
    -Copy and paste the below code of your choice into the file.
    delelog.bat WITH PROMPT Yes/No/All
    Code:
    del /p .\Logs\eqlog*
    delelog.bat NO PROMPT just smash!
    Code:
    del /q .\Logs\eqlog*
    -In EQ create a macro.
    Dele Log EQ macro (updated 9/2/2021)
    Code:
    /pause 9,/log off
    /system .\logfiles\delelog.bat
  6. MasterMagnus The Oracle of AllHigh

    5. Scheduled Backup and Deletion. Wizards do it on schedule.
    This time we'll make a batch file to back up and then delete all your logs at once, and I'll leave it to you to hook up to a button if you wanted.

    But you don't need a button for this one, we can use the awesome Windows Task Scheduler! Allowing us to automate this task in a very flexible way.

    This will create a folder in Everquest\logfiles\ with the Date as a folder name, and copy all your eqlog_Name_server.txt files as-is without changing the name. For better use with parsers. Then delete your source files in Everquest\Logs\

    -Create a text file in the Everquest\logfiles\ folder.
    -Copy and paste the below code into the file.
    backall.bat (updated 9/2/2021-7:00am with better error checking)
    Code:
    for /f %%f in ('dir /b .\Logs\eqlog*.txt') do echo F|xcopy /j /q /y /v .\Logs\%%f .\logfiles\%date:~-4,4%%date:~-10,2%%date:~-7,2%\%%f
    if errorlevel 5 goto exit
    if errorlevel 4 goto exit
    del /f /q .\Logs\eqlog*
    :exit
    -Rename the file: backall.bat

    Watch this video on how to use Windows Task Scheduler


    When instructed to choose the Program for the 'Action', browse to the Everquest\logfiles\backall.bat you made. Also in the settings of the Program, set the 'Start In' folder to the full path of your \Everquest\ folder.
  7. MasterMagnus The Oracle of AllHigh

    6. The minutia. For Gnomes.
    pro gnomes:
    -xcopy does most of the heavy lifting in these methods.
    -I'm using the /J switch with xcopy which accommodates very large files.
    -echo F|xcopy is used to 'pipe' the F key to the xcopy question 'file or directory', because we are using an ambiguous name with variables.

    newbie gnomes:
    -@echo off turns off the display of typed lines.
    -echo. types a blank line.
    -xcopy copies files with a lot of control available.
    -del deletes files, /p prompts 'are you sure', /q is 'quiet' and doesn't ask.
  8. MasterMagnus The Oracle of AllHigh

    Ok. I guess it's pretty much ready if anyone was waiting to laugh. ;)
  9. Tucoh Augur

    Wow, i never knew you could send shell cmds in EQ. Thanks for the guide.
    MasterMagnus likes this.
  10. Wulfhere Augur

    Nice idea.

    For the scripts that delete files, I suggest error checking on copy operations to avoid data loss. I think you know what I mean.
    MasterMagnus likes this.
  11. Bigstomp Augur

    Nice. I did not realize there was a /system.
    MasterMagnus likes this.
  12. MasterMagnus The Oracle of AllHigh


    Wanted to keep it as simple as possible, errors just drop out and return to EQ.

    But yes, especially considering the possibility of huge file sizes.

    Will add an errorlevel check and /v (verify) to xcopy I guess. Had anything else in mind?
  13. Wulfhere Augur

    The /pause times are a bit arbitrary. If the /system command is async (now or in the future) this can be a race condition. What has your testing shown about this?
  14. MasterMagnus The Oracle of AllHigh


    For unimportant pauses I used /pause 9 to cover server lag only.

    The only potential issue is with 'snaplog.bat', /pause 12, may not wait long enough. I didn't have a very large file to test with.

    I'll add a bit to the note about not using with large files.

    *edit*
    Thank you for the sanity checks!
    Yinla and Twelvestrings like this.
  15. MasterMagnus The Oracle of AllHigh

    Updated 'backlog.bat' and 'backall.bat' with better error checking. Re-copy and paste into your batch file if you used the original versions.

    Also, thanks again to Wulfhere for the suggestions, and thanks Khat_Nip for jogging me mentally about a great way to do this.
  16. Elyssanda Bardbrain

    MM the largest log file I have is 1,399,478 KB... because I forgot to archive save it. I found out it was to large to open with Kiz' parser.
  17. MasterMagnus The Oracle of AllHigh

    From this page
    https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/xcopy

    I am using this 'switch' to attempt to handle large files.
    /j Copies files without buffering. Recommended for very large files. This parameter was added in Windows Server 2008 R2.

    In general Windows handles up to 2GB files with no problem (which your file is less than anyway). In some older systems a larger than 2GB file may cause issues.

    It's my belief that my code above will handle files larger than 2GB easily. This is a built in windows function. But to be clear, I HAVE NOT TESTED WITH FILES OVER A FEW MB.

    If it were me, to be safe. If you have a file over 2GB, by hand copy it to a backup folder and delete the original.

    Then afterward try to keep below that before backing up. Which is my hope this tutorial helps with for people.

    Does that help? Were you asking about splitting that file up so you could parse it? (actually now that seems like what you were asking)
  18. MasterMagnus The Oracle of AllHigh

    Silly me. If you're asking about breaking that file up in smaller chunks so you can parse. Let me think on that for a few. Bet I could cobble something together.
  19. Accipiter Old Timer


    Download Notepad++. It can handle files up to 2GB. It might take a long time to open, but once the file is open you can start copy, pasting chunks of it and moving them to new files.

    My personal favorite is Sublime Text 3 but I don't think it does as well on large files as Notepad++.
    MasterMagnus likes this.
  20. MasterMagnus The Oracle of AllHigh


    Ding ding ding.

    Do that. Upon thinking on it, I was going to recommend the same thing.

    You'll want to see the timestamps to break it into logical chunks. You could probably get away with breaking that specific file into three parts, just roughly judging from the scroll bar.