Lookup operator
- lookup
-
Retrieves specified fields from a lookup table based on matching values between your log data and the table’s primary key(s).
lookup
Retrieves specified fields from a lookup table based on matching values between your log data and the table’s primary key(s).
Enrich log data by merging it with information from pre-defined lookup tables. Lookup adds context, detail, and external data to the logs, significantly improving analysis and troubleshooting.
- Syntax
-
lookup field1 as alias1, field2 as alias2, ... \ (1) from "tableName" \ (2) on factTableKey1 = lookupTableKey1, factTableKey2 = lookupTableKey2, ... \ (3)none1 field1 as alias1, field2 as alias2, …: Defines the fields to retrieve from the lookup table, and assigns aliases to them. Mandatory when retrieving multiple fields.2 from "tableName": Specifies the name of the lookup table.3 on factTableKey1 = lookupTableKey1, factTableKey2 = lookupTableKey2, …: Establishes the join condition(s) using primary keys from both the log data (fact table) and the lookup table. - Limitations
-
-
Create lookup tables and populate them in the Kloudfuse UI before using the
lookupoperator. -
Maximum size of a lookup table is 50 MB.
-
Must use compatible data types for join conditions.
-
Must use the lookup table’s primary key(s).
-
- Examples
-
Enrich Web Server Logs with User Location Data
Provide valuable geographic context for your web traffic analysis.
When using a lookup table
UserLocationswith columnsuserID,country, andcity, add the user’s country and city to the web server access logs matching on theuserIdfield.| lookup country as userCountry, city as userCity from "UserLocations" on userId = userIDnoneThe query retrieves the
countryandcityfields fromUserLocationslookup table by matching theuserIdfield, and adds them to your logs asuserCountryanduserCityrespectively.Correlate application errors with error codes and descriptions.Turn a simple error code within the original logs into a full description.
When you have a lookup table
ErrorCodeswith columnserrorCodeanderrorDescription, you can add detailed error descriptions to application error logs by matching on theerrorIdfield.| lookup errorDescription as errorMessage from "ErrorCodes" on errorId = errorCodenoneThis query adds the
errorDescriptionfrom theErrorCodestable aserrorMessageto the log entries.Add product category and region based on productIDQuickly analyse logs related to sales or product.
Use a lookup table
ProductInformationwith columnsProductID,Category, andRegion.| lookup Category as ProductCategory, Region as SalesRegion from "ProductInformation" on product_id = ProductIDnoneAdd the
CategoryandRegionto each log line asProductCategoryandSalesRegionwhen matching theproduct_idvalue from the log line withProductIDin theProductInformationlookup table.