Add k8s namespace to S3 Bucket path

Currently attempting to filter out the K8S namespace from the logs being pushed to S3 via Fluentd.

Attempted to filter the value for the K8S namespace by using:

<filter kubernetes.**>
  @type record_transformer
  enable_ruby true
  <record>
    kubernetes_namespace_name ${record["kubernetes"]["namespace_name"]}
  </record>
</filter>

And then use it in the path value by evaluating the value inline:

<match kubernetes.application.**>
  @type copy
  <store>
    @type s3
    <assume_role_credentials>
      role_arn          "#{ENV['FLUENTD_ROLE_ARN']}"
      role_session_name "#{ENV['FLUENTD_ROLE_SESSION_NAME']}"
    </assume_role_credentials>
    s3_bucket "#{ENV['FLUENTD_S3_ACCESS_POINT_ARN']}"
    s3_region "#{ENV['AWS_REGION']}"
    path "application-${record['kubernetes']['namespace_name']}"
    <buffer tag,time>
      @type file
      path /var/log/fluent/s3
      timekey 10 # 1 hour partition
      timekey_wait 10
      timekey_use_utc true # use utc
      chunk_limit_size 256m
    </buffer>
  </store>
</match>

Constantly getting an error stating that record is unknown to Fluentd.

Does anyone got an idea on how to deal with this situation or what I might be missing/doing wrong ?

Thanks