Uploaded image for project: 'OpenShift Logging'
  1. OpenShift Logging
  2. LOG-2729

The IndexManagement script breaks curation for ElasticSearch if there are hyphens in index names

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Major
    • None
    • None
    • Log Storage
    • False
    • None
    • False
    • NEW
    • NEW

    Description

      Every 15 minutes the curator job runs (as created by the OpenShift ElasticSearch Operator, version 5.4.2). In the /tmp/scripts/indexManagement shell script, if an index returns "false" when rollover is checked then some code is run to increment the index number. This code assumes that there are no hyphens in the index name (i.e. assumes "app-001234", not "app-smr-e2e-002243"). The code takes the text after the 1st hyphen (and up to the 2nd if present) as the number (here it would be "001234" in the first example, "smr" in the second) . It then tries to increment that "number", which obviously fails in the second example. When this happens, the script terminates early and doesn't process any remaining indices.

      The actual code is at about line 84 of /tmp/scripts/indexManagement

          if [ "$responseRollover" == False ] ; then
            # already in bad state
            echo "Calculating next write index based on current write index..." 
      
            indexGeneration="$(echo $writeIndex | cut -d'-' -f2)"
            writeBase="$(echo $writeIndex | cut -d'-' -f1)"
      
            # if we don't strip off the leading 0s it does math wrong...
            generation="$(echo $indexGeneration | sed 's/^0*//')"
            # pad the index name again with 0s
            nextGeneration="$(printf '%06g' $(($generation + 1)))"
            nextIndex="$writeBase-$nextGeneration"
          else
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              rhn-support-kiyyappa Kosal Raj Iyyappan (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: