question

arnaud d. avatar image
arnaud d. asked ·

capture a value on cookie

Hello,

I want to caputre only one value in the cookie in the request header. I have modify my sensor configuration to capture the cookie.

I arrived to catch all the value of the cookie:

dossiercourant_13=TS35g38int%212610576AR%7C2610576540246+%2827%29+-+61+08PO3+V+-+LATTRE+ISABELLE+NEE+BOBI%7CI%7Cfalse%23; JSESSIONID82=C53F34180B58957FJF3KB17ACC8CF; synchrojw=46#jboss#N; AgoraChainId_JB=C537CBB17ACC8CF; derniersdossiers_82=TS46%21162030022%7C1620030022+%2862%29+MART+ADIREN%23; dossiercourant_82=TE46g38int%211231046046001%7C1231046046001+%2846%29+POLI+JEAN%7CI%7Cfalse%23TE17g38int%212350633063141%7C2350633063141+%2815%29+-5+35+01062+C+-+LUDO+MICHEL+NEE+BUY%7CI%7Cfalse%23TS46g38int%211620230030022%7C1620230030022+%2862%29+MART+ADIREN%7CI%7Cfalse%23; jetonIntranetMenu=CbZB%2B01D1gP7eo3jBB%2BYihX1CjgS7u9viYX1LzZ8%2Bh2tXlnIo4JHweheTB%2FEyDX6sVsv%%3D

I just want JSESSIONID82=C53F34180B58957FJF3KB17ACC8CF

How can I do that?

thanks,

Regards

Arnaud

 

PS:

my problem is the same as:

https://community.dynatrace.com/community/display/DTFORUM/Can+we+capture+only+specific+cookies+from+the+Request+Headers

This option has been created since 2013, october?

 

production
10 |2000000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 50.0 MiB each and 250.0 MiB total.

Graeme W. avatar image
Graeme W. answered ·

Arnaud,

You need to extract the cookie you want using a regular expression in the Transformation Regex field, like this:

where you substitute your own cookie name.  For example, you would use the regular expression:

     JSESSIONID82=([^;]*)

or if you need to match any number at the end of the cookie name:

     JSESSIONID(?:\d)*=([^;]*)

Let us know if this works!

-- Graeme

Share
10 |2000000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 50.0 MiB each and 250.0 MiB total.

Rajesh S. avatar image
Rajesh S. answered ·

Just words of caution, Session ID would cause measure explosion if kept in splitting.

1 comment Share
10 |2000000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 50.0 MiB each and 250.0 MiB total.

If the length of your Jsession id is constant and contains only capitals and numbers you could use JSESSIONID(?:\d)*=([A-Z0-9]{29})

0 Likes 0 · ·
Graeme W. avatar image
Graeme W. answered ·

Munawar,

For .NET, modify the ASP .NET sensor configuration properties (in System Profile --> Agent Group --> Sensor Configuration). Add source=Request Cookies and specify the cookie you want to capture in the attribute column. Leave the "attribute" column blank if you want them all.

For Java, modify the servlet sensor configuration properties to capture source=Request Header, attribute=cookie. This will capture all the cookies at once.

If you need more details, respond with a screen shot of however far you got.

-- Graeme

Share
10 |2000000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 50.0 MiB each and 250.0 MiB total.

Munawar T. avatar image
Munawar T. answered ·

Hi @arnaud dubois

can share how you manage to capture the cookies, thanks.

Munawar

Share
10 |2000000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 50.0 MiB each and 250.0 MiB total.

Graeme W. avatar image
Graeme W. answered ·

Arnaud,

There's no way to capture a particular cookie – you have to capture the whole cookie header and extract the one(s) you want.

You can see all of the cookies in the lower pane of the PurePath dashboard by right-clicking on the first or fourth lines (depending on whether you have a web server and where you're collecting the cookie) and opening up "Details", but as you've observed, you get all the cookies – the entire cookie header – this way.

If you create a splitting measure and a business transaction for the cookie value that you're interested in, you can see the value of the business transaction in the upper pane of the PurePath dashboard by showing (unhiding?) the 'Transactions' column.  However, this column will show all the business transactions for each PurePath, so it can be a bit unwieldy.  If you create a business transaction split on JSESSIONID, make sure you clear the "Store Results in Performance Warehouse" check box.

If you want to see the PurePaths with a specific JSESSIONID, you can do that with the "magnifying glass" search icon in the toolbar.  The dialog box has two tabs, one of which allows you to specify any business transaction and any splitting value to search on.

-- Graeme

Share
10 |2000000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 50.0 MiB each and 250.0 MiB total.

arnaud d. avatar image
arnaud d. answered ·

Thank you for your answers.

I try to create this measure, but how can I see the result? I must create a business transaction? It 's not possible to see it in a column in purepath view?

Regards

Arnaud

Share
10 |2000000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 50.0 MiB each and 250.0 MiB total.

Kyle K. avatar image
Kyle K. answered ·

Another thing to consider is ensuring that you are capturing enough string length to pull the full value of the cookie.

Share
10 |2000000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 50.0 MiB each and 250.0 MiB total.