cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

RegEX for UserID

ulf_thornander3
Inactive

Hi

I have some users IDs turning up in the XML decoder.

They have 2 different structures:

<ns3:Name>DOMAIN\A89569</ns3:Name>

<ns3:Name>A89569</ns3:Name>

The DOMAIN and following backslash can be handled with [^\\]*\\([^<]*) but then the other variant yields nothing. Is there someone that has an idea how to extract just the "the string between </ and > OR \"

So what I need to express is the OR thing

19 REPLIES 19

adam_piotrowicz
Dynatrace Pro
Dynatrace Pro

It could be a challenge to write such regex, I'm not sure if AMD would understand any alternatives ...

Thought that one of these regexes could help but no luck.

If there is no one with AMD-side ideas then my recommendation would be to let the AMD report both types of user names and cut the domain when processing the data on CAS.

To do so go to Advanced Properties Editor on CAS and update/create the following properties:

MAP_CLASS_IPUserForce-map=adlex.rtm.repository.ClientForceRegexMap
ClientGroupMapLeaveIfNotMatches = 1
ClientGroupMapLeaveIsGroupFirst = 1
ClientGroupMapRegex = (.+)\\(.+)

and make sure:

MAP_CLASS_UserGroup-map

property is empty, otherwise (precisely, if filled with MAP_CLASS_UserGroup-map value) the DOMAIN will land in Client group DMI dimension.

It's global but user names that don't fall under this regex will be untouched.

The only disadvantage is that data for these two users types will be merged only on CAS, not on the AMD level, in zdata data files.

In case it's not working first of all make sure with:

select * from rtmprops where PropertyName like '%ClientGroupMap%' or PropertyName like '%MAP%'

SQL query sure that the changes got saved as new properties editor likes to be moody.

Hi @Adam Piotrowicz I suppose I should turn on "MAP_CLASS_IPUserForce-map"?

Only if you want the domain name to be inserted into DMI' dimension called Client Group and be removed from user name.

If you just want to not display the domain neither in Client Group nor in username - leave this property empty.

OK - It checked out alright once I changed the SQL a bit to:

select * from delta.RtmProps where PropertyName like '%ClientGroupMap%' or PropertyName like '%MAP%'.

Unfortunately all the users have gone home so I will have to wait until tomorrow to see if there is anyone keen to do a Little bit of work 🙂

Ups. In the previous comment I meant MAP_CLASS_UserGroup-map that when left empty will remove the domain. Not MAP_CLASS_IPUserForce-map - this one must be set to adlex.rtm.repository.ClientForceRegexMap value in order to let the regex start working. Just get rid off equal sign at the begging of adlex.rtm.repository.ClientForceRegexMap ...

So this is right then?

Yeap. That's good.

Hmm - better than desired - all users disappeared 🙂

janusz_dabrowsk
Dynatrace Pro
Dynatrace Pro

Ulf

try

${perl}##([^\\>]+)(?=<\/)

Hi Janusz

Good idea and it works in RUM Console, both the Wizard and the manual.

Unfortunately it doesn't work in the CAS though 😞 Still getting leading Domain\

I think it might deserv a ticket.

Ulf,

File a ticket please and we will find with Dev the correct regex.

I think I will try your other suggestion first

Adam, regex proposed I tested on both console and in rtm regex checker and it worked. Could you check why it does not work while traffic processing as Ulf claims?

Sure, that was the purpose of ticket request ...

But if I did the CAS trick then we won't be able to see if the Regex works or not?

I tried the Regex both in XML and in SOAP and both checked out OK but still the Domain\ turned up in CAS.

I suppose I can a trace and then we can run it in a sanbox though.

No, you will be able to find it out: CAS will have domains removed, but you will be able to inspect RUM Console's regex output in zdata files - if there will be no domains then than the AMD who ripped it off and CAS will have nothing to do ...

ulf_thornander3
Inactive

I'm trying another approach - Is there any such thing as a single wildcard in the Tag definition in the SOAP decoder?

I know you can use * but there doesn't seem to be any way to do a single wildcard for the tag itself.

The challenge at hand is poor coding practices. Some developers use all lower case while others mix.

I doubt, @Wojciech Kurek, could you confirm?

janusz_dabrowsk
Dynatrace Pro
Dynatrace Pro

Ulf, try another, less sophisticated one (given that "Name" or "name" string is constant)

([^>\\]*)<\/[^:]+:[Nn]ame>$  

or just

([^>\\]*)<\/[^:]+:[^>]+>$

for any element name.

Note: these are POSIX-extended regexes.