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!

Building Reliable Asset and Identity Frameworks in Splunk ES

 Accurate asset and identity resolution is the backbone of security operations. Without it, alerts are ...

Cloud Monitoring Console - Unlocking Greater Visibility in SVC Usage Reporting

For Splunk Cloud customers, understanding and optimizing Splunk Virtual Compute (SVC) usage and resource ...

Automatic Discovery Part 3: Practical Use Cases

If you’ve enabled Automatic Discovery in your install of the Splunk Distribution of the OpenTelemetry ...