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
    kubernetes_namespace_name ${record["kubernetes"]["namespace_name"]}

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

<match kubernetes.application.**>
  @type copy
    @type s3
      role_arn          "#{ENV['FLUENTD_ROLE_ARN']}"
      role_session_name "#{ENV['FLUENTD_ROLE_SESSION_NAME']}"
    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

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 ?