strcat() / tolower() / toupper()

strcat(a, b, ...) joins its arguments into one string. It takes any number of arguments, from columns or literals:

| extend Endpoint = strcat(RemoteIP, ":", tostring(RemotePort))

Arguments that are not strings are converted to text, but converting explicitly with tostring() makes your intent clear. On this site, strcat() accepts strings, whole numbers and booleans.

tolower(x) and toupper(x) return the string in lower or upper case.

Why change case?

Grouping, distinct, join keys and == all compare text with exact case. If the same user appears as Tomas.Kral and tomas.kral, they count as two values. Normalising first fixes that:

| extend Account = tolower(Account)
| summarize Logons = count() by Account

For a simple filter you don’t need to change case: use =~, in~, has or startswith, which ignore case already.

Things to know

  • strcat() with a single argument just returns it as text. Empty strings add nothing, so missing values don’t break the result; they only leave a gap between the separators.
  • To cut a string apart again, use split() or extract().

Examples

1 A readable summary line per row
AuditLogs
| where OperationName == "Reset user password"
| project TimeGenerated, Summary = strcat(toupper(Result), ": ", Identity, " reset a password")
2 Group by a lower-case name
DeviceProcessEvents
| summarize Runs = count() by Name = tolower(FileName)
| top 2 by Runs
3 Build a domain\user key from two columns
SecurityEvent
| where EventID == 4624 and Computer == "SRV-FILE01.kestrelbay.example"
| extend Who = strcat(TargetDomainName, @"\", TargetUserName)
| summarize Logons = count() by Who

Practice it

None of the free exercises needs this one yet.