AppD Archive

Data Collectors for HTTP Session Attributes

CommunityUser
Splunk Employee
Splunk Employee

Is it possible to use an expression to retrieve a value from an HTTP session? I'm trying to capture the username for each HTTP request. The username is stored in a UserProfile object stored as a session attribute with key of 'userProfile'.

I have added a method Data Collector to retrieve the username from the UserProfile on method 'getStaffName()'. I have also added an HTTP data collector that retrieves the sessionkey 'userProfile'. Unfortunately, the getStaffName method does not appear to be called for every request, and the UserProfile object does not have a 'toString' defined.

Is it possible to use an expression to extract a specific field from an object stored as a session attribute?

0 Karma

Arun_Dasetty
Super Champion

Hi,

Have you checked below custom expression referred in below screenshot and see if that helps here:

image.png

Regards,

Arun

0 Karma

CommunityUser
Splunk Employee
Splunk Employee

Unfortunately, that only works when naming a Business Transaction. If you want to use a Data Collector to extract data from a session attribute, it gets a bit more difficult.

 For example, here is the definition of the Data Collector:

image.png

you can see the output of the data collector in HTTP Params, but since there is not toString, it's pretty useless.

image.png

So the question is, can I use an expression when defining a session key for a data instead of a fixed value?

0 Karma

CommunityUser
Splunk Employee
Splunk Employee

Since I am only attemptive to retrieve the user id, I was able to use an expression on User Principal to retrieve the user id I need.

image.png

0 Karma

Arun_Dasetty
Super Champion

Hi David,

i meant sample config, as i stated and you have noticed custom expression is applicable for both BT and http collector collection, good to hear custom expression helped here.

0 Karma
Get Updates on the Splunk Community!

Fun with Regular Expression - multiples of nine

Fun with Regular Expression - multiples of nineThis challenge was first posted on Slack #regex channel ...

[Live Demo] Watch SOC transformation in action with the reimagined Splunk Enterprise ...

Overwhelmed SOC? Splunk ES Has Your Back Tool sprawl, alert fatigue, and endless context switching are making ...

What’s New & Next in Splunk SOAR

Security teams today are dealing with more alerts, more tools, and more pressure than ever.  Join us on ...