Open marinaaaniram opened 1 year ago
Right, kafka_log
is not allowed in an if
block.
What you can do is use variables in the expression for topic
- if the expression evaluates to an empty string, the module does not send any message.
For example, the sample conf you pasted could be rewritten to something like this -
http {
map $download_url $topic {
"" "";
default my_topic_name;
}
server {
location / {
kafka_log kafka:$topic $download_log;
}
}
}
I'm trying to do:
but got error:
"kafka_log" directive is not allowed here
So, what should I do if I need to log only certain URLs? And in the location I have a lot of other settings, so I don’t want to take these urls to another location and duplicate half of the config...