anthonygauthier/jmeter-elasticsearch-backend-listener

Header-based variables don't send to elastic

leonsery opened this issue · 11 comments

I added the following headers into JMeter:
image

I can see them in the traffic:
image

Unfortunately, corresponding variables don't appear in the elastic index!

Could you provide me with your whole listener configuration? Thanks

Should I change es.parse.all.req.headers to true?
Yes! It seems to be true. Please mention this somewhere in the help

Very true, the if-else clause isn't needed in this case. Probably some left over code that wasn't cleaned up probably during a refactor.

Anthony!
There is some issue here...
To send updatable variable we need to use es-[...] syntax AND set all requests to true. But in this case listener sends ALL the headers (es-[...] and also NOT es-[...]). So, why we should provide this es- prefix at all?
I'm sorry, something wrong here.

The following condition states that;

if (!this.allReqHeaders && header[0].startsWith("X-es-backend") || this.allReqHeaders)
IF allReqHeaders IS false AND the current header starts with "X-es-backend" 
  OR IF allReqHeaders IS true 
THEN add the header to the ElasticSearch document 

The doc is wrong, I'll fix it.

I have reuploaded the JAR for the 2.6.9 release - please replace the one you are currently using.

@leonsery First of all, replace your JAR with the new one (2.6.9 - same version, just a re-upload).

Then you'll have to change your headers to look like this

X-es-backend-{{ yourVariableName }}: {{ yourVariableValue }}

Hi,
I back to my project only now...
I cannot get this work anyway...
According to this code

       LinkedList<String[]> headersArrayList = new LinkedList<String[]>();
       if (allReqHeaders) {
            headersArrayList.add(this.sampleResult.getRequestHeaders().split("\n"));
       }

headersArrayList is populated ONLY when allReqHeaders is True.
So, I definitely must to set it to True.

But, in this case the following statement is always false!
!this.allReqHeaders && header[0].startsWith("X-es-backend")

This means it will send or all the headers or nothing!
I don't need to send all the headers to elastic, but only started with "X-es-backend".