Last active
August 29, 2015 14:00
-
-
Save cvializ/11294031 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -XDELETE 'http://localhost:9200/accesscontrol/' | |
curl -XPUT 'http://localhost:9200/accesscontrol/' -d '{ | |
"mappings" : { | |
"group" : { | |
"properties" : { | |
"name" : { "type" : "string" }, | |
"hosts" : { "type" : "string" } | |
} | |
}, | |
"user" : { | |
"_parent" : { "type" : "group" }, | |
"_routing" : { "required" : true, "path" : "group_id" }, | |
"properties" : { | |
"name" : { "type" : "string" }, | |
"group_id" : { "type" : "string" } | |
} | |
} | |
} | |
}' | |
# Create the user groups and specify which computers | |
# they may view logs for | |
curl -XPUT 'http://localhost:9200/accesscontrol/group/intern' -d '{ | |
"name" : "intern", | |
"hosts" : ["computer1"] | |
}' | |
curl -XPUT 'http://localhost:9200/accesscontrol/group/admin' -d '{ | |
"name" : "admin", | |
"hosts" : ["computer1","computer2","computer3"] | |
}' | |
# Create the users and specify the groups they belong to. | |
curl -XPUT 'http://localhost:9200/accesscontrol/user/cvializ?parent=intern' -d '{ | |
"name" : "cvializ", | |
"group_id" : "intern" | |
}' | |
curl -XPUT 'http://localhost:9200/accesscontrol/user/frank?parent=admin' -d '{ | |
"name" : "frank", | |
"group_id" : "admin" | |
}' | |
# Create the logstash alias for cvializ | |
curl -XPOST 'http://localhost:9200/_aliases' -d ' | |
{ | |
"actions" : [ | |
{ "remove" : { "index" : "logstash-2014.04.25", "alias" : "cvializ-logstash-2014.04.25" } }, | |
{ | |
"add" : { | |
"index" : "logstash-2014.04.25", | |
"alias" : "cvializ-logstash-2014.04.25", | |
"filter": { | |
"terms" : { | |
"host" : { | |
"index" : "accesscontrol", | |
"type" : "user", | |
"id" : "cvializ", | |
"path" : "group.hosts" | |
}, | |
"_cache_key" : "cvializ_hosts" | |
} | |
} | |
} | |
} | |
] | |
}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment