{"record":{"id":"2974d3714a8f24c9","repo":"apache/skywalking","slug":"unknown-log-field-log-firstname-supported-meta","errorCode":null,"errorMessage":"Unknown log field: log.{firstName}. Supported metadata fields: {metadataGetters}, LogData fields: {logGetters}","messagePattern":"Unknown log field: log\\.(.+?)\\. Supported metadata fields: (.+?), LogData fields: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"oap-server/analyzer/log-analyzer/src/main/java/org/apache/skywalking/oap/log/analyzer/v2/compiler/LALValueCodegen.java","lineNumber":929,"sourceCode":"            return;\n        }\n\n        String current;\n        boolean needsBoxing = false;\n        String boxType = null;\n\n        // Determine root based on first field\n        final LALScriptModel.ValueAccessSegment first = chain.get(0);\n        if (!(first instanceof LALScriptModel.FieldSegment)) {\n            current = LOGDATA_BUILDER_CAST;\n        } else {\n            final String firstName = ((LALScriptModel.FieldSegment) first).getName();\n            if (LALCodegenHelper.METADATA_GETTERS.containsKey(firstName)) {\n                current = \"h.ctx().metadata()\";\n            } else if (LALCodegenHelper.LOG_GETTERS.containsKey(firstName)) {\n                current = LOGDATA_BUILDER_CAST;\n            } else {\n                throw new IllegalArgumentException(\n                    \"Unknown log field: log.\" + firstName\n                        + \". Supported metadata fields: \"\n                        + LALCodegenHelper.METADATA_GETTERS.keySet()\n                        + \", LogData fields: \"\n                        + LALCodegenHelper.LOG_GETTERS.keySet());\n            }\n        }\n\n        for (int i = 0; i < chain.size(); i++) {\n            final LALScriptModel.ValueAccessSegment seg = chain.get(i);\n            if (seg instanceof LALScriptModel.FieldSegment) {\n                final String name = ((LALScriptModel.FieldSegment) seg).getName();\n                if (i == 0 && LALCodegenHelper.METADATA_GETTERS.containsKey(name)) {\n                    if (\"traceContext\".equals(name)) {\n                        current = current + \".getTraceContext()\";\n                    } else {\n                        current = current + \".\"\n                            + LALCodegenHelper.METADATA_GETTERS.get(name) + \"()\";","sourceCodeStart":911,"sourceCodeEnd":947,"githubUrl":"https://github.com/apache/skywalking/blob/102af09b4a56064e22050dded10e2c52e490d040/oap-server/analyzer/log-analyzer/src/main/java/org/apache/skywalking/oap/log/analyzer/v2/compiler/LALValueCodegen.java#L911-L947","documentation":"Thrown at LAL compile time when log.<field> is used and <field> is neither a LogMetadata field (service, serviceInstance, endpoint, layer, timestamp, traceContext) nor a LogData field (body, tags). The message lists the exact supported key sets from LALCodegenHelper.METADATA_GETTERS and LOG_GETTERS, so it doubles as documentation.","triggerScenarios":"log.serviceName, log.bodyText, log.tracecontext (wrong case), log.timestampMillis — any first path segment outside the two getter maps; also method-style chains whose first element is not a FieldSegment get defaulted into the LogData cast path and then fail this check.","commonSituations":"Guessing field names instead of checking the grammar; casing mistakes (log.Service); assuming v1 Groovy dynamic property lookup still works in the v2 typed compiler.","solutions":["Use one of the metadata fields: log.service, log.serviceInstance, log.endpoint, log.layer, log.timestamp, log.traceContext","Use one of the LogData fields: log.body, log.tags","For trace fields, chain through log.traceContext.traceId / traceSegmentId / spanId","If you need a body sub-value, parse it with json{}/yaml{}/text{} and use parsed.*"],"exampleFix":"# before\nservice log.serviceName as String\n\n# after\nservice log.service as String","handlingStrategy":"validation","validationCode":"# Supported first segments (fixed sets in LALCodegenHelper):\n# metadata: service, serviceInstance, endpoint, layer, timestamp, traceContext\n# logData:  body, tags\n# Verify rule fields against these lists before deploy:\n#   grep -oE 'log\\.[A-Za-z]+' my-rule.yaml | sort -u","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Copy log.* paths from shipped lal/*.yaml examples rather than guessing","Use tag(\"KEY\") for tags, parsers for body content","Add a CI lint step that checks log.* segments against the fixed set"],"tags":["lal","log-analyzer","compiler","field-access"],"backgroundTag":null,"analyzedSha":"102af09b4a56064e22050dded10e2c52e490d040","analyzedAt":"2026-08-14T10:47:52.647Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}