[DONE] Chooose variables from http headers


(Psaiz) #1

Hi Simone,

It would be nice if the rules could contain some variables that are passed in the http headers. The idea would be that in the fields of the rules (like groups, hosts, uri_re, indices, kibana_index on index_rewrite we could put things like:

indices:

and MY_VAR1 was in fact read from the HTTP headers

Does this make sense?
Cheers,
pablo


(Diego Nieto Cid) #2

I like this idea!

Specially if it goes toward a more general mini key-value store attached to the request where rules can save useful information for those ahead in the evaluation chain.

Could be handy for the jwt_auth idea I’m about to post :slight_smile:


(Simone Scarduzio) #3

Hey @psaiz, what you proposed is really cool and is now in master.


(Psaiz) #4

Hi Simone, thanks a lot!

Thanks a lot for working on this one, and for the very fast prototype! This looks very promising.
We’ve been testing the prototype, and ran into a couple of issues:

  1. lowercase/uppercase. It looks like in the elasticsearch.yaml, the name of the variable has to be lowercase
  2. The current approach is to have @var_name . In this model, how can we specify a suffix? Would it be possible to do something like @{var_name}, so that we can define exactly where the variable name ends?
  3. Imagine that the rule refers to a non-existent header. At the moment, this will keep it with ‘@var_name’, which might not be what we want. Would it be possible to delete the entry if the variable does not exist in the header?

Thanks a lot
pablo


(Simone Scarduzio) #5

All is fixed in the release I just published 1.15.0