Strlen

strlen

Returns the number of characters in a string.

Syntax

strlen(string)
  • string: The input string to measure.

Returns

An integer representing the number of characters in the string.

Examples

Get the length of a string:

datatable(s:string) ["Hello, world!"]
| extend length = strlen(s)

Expected output:

slength
Hello, world!13

Get the length of a column value:

datatable(s:string) ["abc", "abcdef", ""]
| extend len = strlen(s)

Expected output:

slen
abc3
abcdef6
0

strlen

Returns the length of a string.

Syntax

strlen(String)

Examples

Filter long messages:

logs
| where strlen(message) > 200

Compute average message length:

logs
| summarize avgLen = avg(strlen(message)) by service