i have a use case where i want to redirect my gke container log of two service which has json.key = "abc" to pub/sub without using log router service so i am using fluentd for this. I am able to route logs to pub/sub but filter is not working my flunetd.conf looks like this
<source>
@type tail
path /var/log/containers/container-name-*.log
pos_file /var/log/fluentd-containers.log.pos
tag test.log
read_from_head true
<parse>
@type none
</parse>
</source>
<filter test.log>
@type grep
<regexp>
key key
pattern /abc/
</regexp>
</filter>
<match test.log>
@type gcloud_pubsub
project_id gcp-project-id
topic gcp-topic
flush_interval 10s
num_threads 1
</match>
My logs are in this format {"message":"Rules received","key":"abc"}