New Server Instance

Our website has been moved to a new server instance at Linode.com in Dallas, Texas, USA. It was running on a 1gb instance, and now it’s running on a 2gb instance. This is trivia.

The point is that if you see something weird, that’s why.

Currently the Download counter isn’t working because this server is using different web server software, back to Apache from Nginx. A different log file format means a different log file parsing script is necessary.

The stats were being counted every minute by an awk script launched as a cronjob on a Debian linux server every minute (because):

*/1 * * * * gawk -f /var/www/karenware.com/web/production/cli/log-parse.awk /var/log/nginx/access.log > /tmp/log-parse.txt

It doesn’t work now because Apache’s log format is different by default, as a result, downloads are not being counted on the website and every page call causes an error to be logged because the file containing the last download count isn’t there because the script fails.

Here’s what the GNU’s AWK (gawk) looked like:

#  https://www.gnu.org/software/gawk/manual/gawk.html#Splitting-By-Content
BEGIN {
    FPAT = "([^ ]+)|(\"[^\"]+\")"
    DOWNLOADS = 0
    BYTES = 0
}

#{
#   print "NF = ", NF
#  for (i = 1; i <= NF; i++) {
#     printf("$%d = <%s>\n", i, $i)
#  }
#}

NR == 1 {
        split( substr($9,2) , dt, ":" )
        DATE = dt[1]
        FIRST = dt[2] ":" dt[3]
}

$1 == 200 && $2 == "\"www.karenware.com\"" && $3 ~ /GET \/d\//     {
        DOWNLOADS++
        BYTES = BYTES + $4
        split( substr($9,2) , dt, ":" )
        LAST = dt[2] ":" dt[3] " " substr( $10, 1, length($10)-1)
}

END {

        if( DOWNLOADS == 0 ) {
                print "No downloads yet, but the day's just getting started."
        } else if( DOWNLOADS == 1 ) {
                print "Someone downloaded a program already today!"
        } else {
                print DOWNLOADS
        }
}

Here’s what the new log entries look like (me downloading Karen’s Directory Printer… I’ve removed my IP address):

999.999.999.999 - - [19/May/2023:09:57:10 -0500] "GET /d/Karens-Directory-Printer-v5.4.4-Setup.exe HTTP/1.1" 200 1779129 "https://www.karenware.com/powertools/karens-directory-printer" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36"

And the new awk script:

#  https://www.gnu.org/software/gawk/manual/gawk.html#Splitting-By-Content
BEGIN {
    FPAT = "([^ ]+)|(\"[^\"]+\")"
    DOWNLOADS = 0
    BYTES = 0
    TODAY=strftime("%d/%b/%Y")
}

#{
#   print "NF = ", NF
#  for (i = 1; i <= NF; i++) {
#     printf("$%d = <%s>\n", i, $i)
#  }
#}

$7 == 200 && $6 ~ /GET \/d\//     {
        split( substr($4,2) , dt, ":" )
        DATE = dt[1]
        if( DATE == TODAY ) {
                DOWNLOADS++
        }

}

END {

        if( DOWNLOADS == 0 ) {
                print "No downloads yet, but the day's just getting started."
        } else if( DOWNLOADS == 1 ) {
                print "Someone downloaded a program already today!"
        } else {
                print DOWNLOADS
        }
}

All fixed up.

2 thoughts on “New Server Instance”

  1. Hi Joe,
    So sorry to now, though 20 years later, to hear of Karen’s home-going. Sounds like she was a believer in The Lord Jesus Christ. Nice! God is good!
    MY PRESENT SITUATION?
    I am having a Dickens of a time successfully running the “Karen’s Directory Printer” program. It disappears so rapidly. I also get NO RESULTS from it that I can correctly find. I don’t want, yet, to use “Print File”. I am attempting to “Save to file”. I am retired, and we have over 1.5 million files at this time. I am having a Dickens of a time (again!) to find files, so this program Would Be of A Great Help.
    Feel free to call.

    1. Sorry you’re having trouble.

      Thank you for the donation. Unfortunately, the problem you’re having has been described to me by a dozen people over 5 years, now a dozen plus one. I’ve never experienced it myself and nobody has yet to solve it. The problem is probably more widespread and people just don’t tell me.

      Maybe your machine has a hint in the Event Viewer. An Application Error of some sort.

      Two weeks ago I exchanged a few emails with a guy who found a hint in the Event Viewer (listed below).


      Log Name: Application
      Source: Application Error
      Date: 01/26/2024 4:29:13 PM
      Event ID: 1000
      Task Category: (100)
      Level: Error
      Keywords: Classic
      User: N/A
      Computer: **REDACTED**
      Description:
      Faulting application name: DirPrn.exe, version: 5.4.0.4, time stamp: 0x5ea0fec4
      Faulting module name: COMCTL32.OCX, version: 6.0.81.6, time stamp: 0x3f41364a
      Exception code: 0xc000041d
      Fault offset: 0x00019603
      Faulting process id: 0x5004
      Faulting application start time: 0x01da50a713ba5562
      Faulting application path: C:\Program Files (x86)\Karen's Power Tools\Directory Printer\DirPrn.exe
      Faulting module path: C:\WINDOWS\System32\COMCTL32.OCX

      My suggestion was to reregister COMCTL32.OCX because it doesn’t live at C:\Windows\System32 on a 64-bit version of Windows. It should be registered at C:\Windows\SysWOW64\COMCTL32.OCX IMHO.

      My suggestion was:

      ** IF “c:\windows\SysWOW64\COMCTL32.OCX” exists, then you can register it again:

      1. Start CMD.exe as Administrator
      2. Run “regsvr32 C:\Windows\SysWOW64\comctl32.ocx” (without the quotes)
      3. Witness a dialog box saying “DllRegisterServer in C:\Windows\SysWOW64\comctl32.ocx succeeded.” (without the quotes)

      Then it might work.

      Like I wrote (edited) — I’ve sent another email to him.

      I’ll send you this in email because I’ve edit this comment so many times, the blog here probably sent you five versions.

      I’ll call if I know something or have some weird question.

      Thanks.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top