Reference to the substring string manipulation function


substring(metric|source|<pointTagKey>, <startInteger>, [<endInteger>,] <tsExpression>)

Returns a substring that is extracted from the specified metadata string.


metric|source|<pointTagKey> The metadata string (metric name, source name, or value of a point tag key) to extract a substring from.
startInteger Starting position of the substring that you want to extract. Positions are counted from left to right, starting with 0.
endInteger Position that immediately follows the last character of the substring to be extracted. Omit this parameter to extract all characters from startString to the end of the metadata string.
tsExpression The expression that describes the time series with the metadata string to extract a substring from.


The substring() function returns a substring that is extracted from the specified metadata string. The extracted substring starts at the position specified by startInteger and ends just before the position specified by endInteger. You can omit endInteger if you want to remove a prefix from the metadata string.


The following example extracts substrings from the value of the service point tag, which is dataingester.

  • The first query specifies 0, 4, to extract the string data
  • The second query specifies 4, 10 to extract the string ingest

ts substring example