Skip to content

Instantly share code, notes, and snippets.

@edefaria
Last active June 12, 2020 16:47
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 edefaria/0de27df3f4148a64b9857f58ceb82381 to your computer and use it in GitHub Desktop.
Save edefaria/0de27df3f4148a64b9857f58ceb82381 to your computer and use it in GitHub Desktop.
#!/bin/bash
SERVER="gra1.logs.ovh.com"
USER="logs-xx-00000"
PASS="xxxxxxxx"
PREFIX="logs-xx-00000"
SUFFIX="elastalert"
cd /tmp
wget https://raw.githubusercontent.com/Yelp/elastalert/master/elastalert/es_mappings/6/elastalert.json https://raw.githubusercontent.com/Yelp/elastalert/master/elastalert/es_mappings/6/elastalert_error.json https://raw.githubusercontent.com/Yelp/elastalert/master/elastalert/es_mappings/6/elastalert_status.json https://raw.githubusercontent.com/Yelp/elastalert/master/elastalert/es_mappings/6/past_elastalert.json https://raw.githubusercontent.com/Yelp/elastalert/master/elastalert/es_mappings/6/silence.json
curl -XPUT -H 'Content-Type: application/json' -u "$USER:$PASS" "https://${SERVER}:9200/${PREFIX}-i-${SUFFIX}/_mapping/_doc" --data @elastalert.json
curl -XPUT -H 'Content-Type: application/json' -u "$USER:$PASS" "https://${SERVER}:9200/${PREFIX}-i-${SUFFIX}_error/_mapping/_doc" --data @elastalert_error.json
curl -XPUT -H 'Content-Type: application/json' -u "$USER:$PASS" "https://${SERVER}:9200/${PREFIX}-i-${SUFFIX}_status/_mapping/_doc" --data @elastalert_status.json
curl -XPUT -H 'Content-Type: application/json' -u "$USER:$PASS" "https://${SERVER}:9200/${PREFIX}-i-${SUFFIX}_past/_mapping/_doc" --data @past_elastalert.json
curl -XPUT -H 'Content-Type: application/json' -u "$USER:$PASS" "https://${SERVER}:9200/${PREFIX}-i-${SUFFIX}_silence/_mapping/_doc" --data @silence.json
rm -f elastalert.json elastalert_error.json elastalert_status.json past_elastalert.json silence.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment