Document toolboxDocument toolbox

Locate (locate)

Description

The field created returns the position of the first occurrence of a specified value in a string, counting from 0. Note that this operation is case sensitive.

How does it work in the search window?

Select Create field in the search window toolbar, then select the Locate operation. You need to specify two arguments:

Argument

Data type

Argument

Data type

String mandatory

string

Substring to locate mandatory

string

The data type of the values in the new field is string.

Example

In the siem.logtrust.web.activity table, we want to know the position of the JS character in the strings of the headers field. To do it, we will create a new field using the Locate operation.

The arguments needed to create the new field are:

  • String - headers field

  • Substring to locate - JS

Click Create field and you will see the following result:

How does it work in LINQ?

Use the operator select... as...  and add the operation syntax to create the new field. This is the syntax for the Locate operation:

  • locate(string, string_to_locate)

Example

You can copy the following LINQ script and try the above example on the demo.ecommerce.data table. 

from demo.ecommerce.data select locate(uri, "?") as `uri_locate_?`