uppercase
Use the uppercase() function to convert all characters in a given string field value or literal to their uppercase equivalents.
Syntax
uppercase (<string>)Parameters
<string>
string
Yes
The input string field or literal value to be converted to uppercase.
Returns
The uppercase() function returns a string with all characters converted to uppercase.
Usage notes
The
uppercase()function is typically used within thealterstage to create new fields or modify existing ones.The function can also be used in
filterstages, particularly in scenarios where case-insensitive comparisons are needed or to align withconfig case_sensitive = falsebehavior.
Examples
Example 1: uppercase() on a direct string field
Goal: Convert the event_description field to all uppercase letters.
XQL code:
Explanation: The uppercase() function converts the text in the event_description field to its all-uppercase equivalent, creating a new field upper_description.
Output:
101
"User login successful"
"USER LOGIN SUCCESSFUL"
102
"File access attempt"
"FILE ACCESS ATTEMPT"
103
"Network connection established"
"NETWORK CONNECTION ESTABLISHED"
Example 2: uppercase() on a string field (for example, Domain Name)
Goal: Standardize domain names in the dst_domain field to uppercase.
XQL code:
Explanation: The uppercase() function transforms the dst_domain strings, including any surrounding quotes, into their uppercase format in the upper_domain field.
Output:
101
"ec2.amazonaws.com"
"EC2.AMAZONAWS.COM"
102
"sts.amazonaws.com"
"STS.AMAZONAWS.COM"
103
"www.google.com"
"WWW.GOOGLE.COM"
Example 3: uppercase() used in conjunction with filter
Goal: Convert raw_log_data to uppercase and then use the result in a filter stage to find specific patterns regardless of original case.
XQL code:
Explanation: The raw_log_data is converted to upper_log_data, which is then used in a contains filter. This effectively performs a case-insensitive search for "process" by first normalizing the case.
Output:
102
"Process cmd.exe attempted to access /etc/passwd"
"PROCESS CMD.EXE ATTEMPTED TO ACCESS /ETC/PASSWD"
105
"Transformed data from source X, processed 1000 records."
"TRANSFORMED DATA FROM SOURCE X, PROCESSED 1000 RECORDS."
Example 4: uppercase() on an extracted JSON string field
Goal: Extract a string value from a JSON field (simple_json_data) and apply uppercase() to it.
XQL code:
Explanation: The status field is extracted from simple_json_data as a string (json_status_string), and then uppercase() converts this extracted value to uppercase for the uppercase_json_status field. Events where the status field does not exist will result in NULL.
Output:
101
{"status": "ok", "code": 200}
"ok"
"OK"
102
{"status": "fail", "error": "access_denied"}
"fail"
"FAIL"
103
{"connection_id": "CONN-001", "protocol": "TCP"}
NULL
NULL
Example 5: uppercase() within arraymap() for an array of Strings
Goal: Convert every element within the string_tags array to uppercase using arraymap().
XQL code:
Explanation: The arraymap() function iterates through each element (@element) of the string_tags array, applying the uppercase() function to each one. The result is a new array, uppercase_tags, where all original elements are now in uppercase.
Output:
101
["security", "login"]
["SECURITY", "LOGIN"]
102
["filesystem", "critical"]
["FILESYSTEM", "CRITICAL"]
103
["network", "cloud"]
["NETWORK", "CLOUD"]
Related articles
Last updated
Was this helpful?
