Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ion-storm/ced9b670149644e000d4a471742727f6 to your computer and use it in GitHub Desktop.
Save ion-storm/ced9b670149644e000d4a471742727f6 to your computer and use it in GitHub Desktop.
Add custom mappings to graylog (elasticsearch) for additional parameters (_MessageParam0...N) added by GELF Logger

Create custom mappings

cat << EOF > graylog-custom-mapping.json
{
  "template": "graylog_*",
  "mappings" : {
    "message" : {
      "properties" : {
        "MessageParam0" : {
          "type" : "string",
          "index" : "not_analyzed"
        },
        "MessageParam1" : {
          "type" : "string",
          "index" : "not_analyzed"
        },
        "MessageParam2" : {
          "type" : "string",
          "index" : "not_analyzed"
        },
        "MessageParam3" : {
          "type" : "string",
          "index" : "not_analyzed"
        },
        "MessageParam5" : {
          "type" : "string",
          "index" : "not_analyzed"
        },
        "MessageParam6" : {
          "type" : "string",
          "index" : "not_analyzed"
        },
        "MessageParam7" : {
          "type" : "string",
          "index" : "not_analyzed"
        },
        "MessageParam8" : {
          "type" : "string",
          "index" : "not_analyzed"
        },
        "MessageParam9" : {
          "type" : "string",
          "index" : "not_analyzed"
        }
      }
    }
  }
}
EOF

Apply custom mappings for Graylog to elasticsearch

curl -X PUT -d @'graylog-custom-mapping.json' 'http://elasticsearch-server:9200/_template/graylog-custom-mapping?pretty'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment