Fluentbit configuration from DAPR AKS extension has error

Staņislavs Barkovskis 0 Reputation points
2025-12-15T11:45:47.0133333+00:00

Hello! I have an aks cluster v. 1.32.7, also i've installed dapr addon, curently it has 1.15.9-msft.1 version. I've noticed that there is a lot of errors in my Log Analytics Workspace.

 The log record says  [2025/10/28 07:35:38] [error] [filter:lua:lua.6] error code 2: /fluent-bit/etc/filters.lua:33: bad argument #1 to 'gsub' (string expected, got nil)

Then I started to search for fluentbit configuration and found the error:

function MaskPersonalIdentifiableInformation(tag, timestamp, record)
    local fields = { "Message", "DaprRawLog" }

    local updated = false

    for _, field in ipairs(fields) do
        local value = record[field]
        if value ~= nil then
            -- Mask ipv4 addresses
            value = string.gsub(value, "(%d%d?%d?%.%d%d?%d?)%.%d%d?%d?%.%d%d?%d?", "%1.0.0")

            -- Mask secrets
            value = string.gsub(input, "eyJ[%w%-_]+%.%w+%.%w+", "REDACTED") -- Error is here: input is not defined

            -- Mask Redis password
            value = string.gsub(value, "password=([^,%s]+)", "password=REDACTED")

            -- Mask other secret values
            value = redact_generic_credentials(value)

            -- Mask UUID strings
            value = string.gsub(value,
                "%x%x%x%x%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%-%x%x%x%x%x%x%x%x%x%x%x%x",
                "{uuid}")

            -- Assign the updated value back to the record
            updated = true
            record[field] = value
        end
    end

    if updated then
        return 1, timestamp, record
    end

    -- No fields were updated
    return 0, timestamp, record
end

This is from dapr-monitoring-cm-fluent-bit config map. Now I'm searching for the right place where to report the issue. Should I report in dapr github or in Microsoft. Maybe you can give me dirct link were to report the issue. Thank you

Azure Kubernetes Service
Azure Kubernetes Service
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Himanshu Shekhar 1,935 Reputation points Microsoft External Staff Moderator
    2025-12-15T12:01:22.6566667+00:00

    @Staņislavs Barkovskis

    It looks like you're running into a Lua script error in the Fluent Bit configuration related to masking personal identifiable information in your Dapr setup on AKS. The specific error message indicates that the variable input is not defined, which is causing the Lua function to fail.

    Here’s a breakdown of the problem and some potential steps you can take:

    Problem Overview - The error message you're seeing:

    error code 2: /fluent-bit/etc/filters.lua:33: bad argument #1 to 'gsub' (string expected, got nil) - suggests that when your function MaskPersonalIdentifiableInformation tries to call string.gsub on input, it's receiving nil instead of a string, leading to the crash.

    Steps to Resolve - Define 'input': Ensure that input is properly defined and initialized before it's used in the function. In your case, it appears there should be a variable that holds the raw log data (possibly the same as 'value' from the record). You might want to change value to input in the line:

    value = string.gsub(input, &((***Redacted***by***CredScan***))", "REDACTED") If input refers to a different source, make sure it’s initialized or defined properly.

    Check Record Fields: Ensure all fields you intend to process exist in your log record. If a log entry happens to miss either the Message or DaprRawLog fields, this could lead to nil values being passed to gsub.

    Add logging inside the Lua function to track which values are being processed, especially before the gsub call. This can help identify which log entries are causing the issue.

    Reporting the Issue - Since this seems to be an issue with the Dapr setup rather than directly related to Azure support, it would be appropriate to report this in the Dapr GitHub repository.

    please make sure to provide a clear description of the issue, including your environment details (AKS version, Dapr version, and any relevant configurations).

    Here are some links to relevant documentation for further insights into troubleshooting and configuring Dapr in Azure AKS:

    1. TroubleShooting Dapr Installation Errors
    2. Dapr Extension for AKS
    3. Common Dapr Issues and Solutions
    4. Dapr GitHub Repository

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.