Not sure where to start with this error message

I see this warning often in fluentd logs

2022-01-11 00:06:30 +0000 [warn]: #0 emit transaction failed: error_class=NoMethodError error="undefined method dig’ for 0:Integer\nDid you mean? div" location="/usr/lib/ruby/gems/2.7.0/gems/fluentd-1.14.0/lib/fluent/plugin_helper/record_accessor.rb:61:in call_dig'" tag="kube.var.log.containers.foo-7795d97798-dgspc_foo_foo-5f18308779211eb06b3a3ddc71b7bd1752c54ba8d0a14216700291de304d926a.log"

This is the processing I am doing on that tag.

<match kube.**>
  @type rewrite_tag_filter
  @id rewrite_tag_filter_kube_container_name
  <rule>
    key $.kubernetes.container_name
    pattern /^(.+)$/
    tag $1.kube
  </rule>
</match>

<match *.kube>
  @type rewrite_tag_filter
  @id rewrite_tag_filter_kube_namespace
  <rule>
    key $.kubernetes.namespace_name
    pattern /^(.+)$/
    tag $1.${tag}
  </rule>
</match>

Since the tag has not been rewritten it seem the error occurs before then Does anyone have any idea how I can troubleshoot this? Thanks!

It seems that event doesn’t contain expected $['kubernetes']['container_name'] or $['kubernetes']['namespace_name'] values. so, it needs to be verify your incoming events at that time.