It looks OK. Are you sure that you are receiving messages that should match? If the condition isn't matching you would see these messages in the var_log_common-* index, as that is where they would land if the condition was false.
What your statement says is... if the value of the source field is /var/log/nginx/access.log or the value of the source field is /var/log/nginx/error.log then output the messages to the index var_log_nginx-%{+YYYY.MM.dd}, otherwise output the messages to var_log_common-%{+YYYY.MM.dd}.
If the source field is not being set as you expect, then the messages won't match and will land in var_log_common-%{+YYYY.MM.dd}.
This is coming from Filebeat. In filebeat 6.x the name of the field was source, as of 7.x the field is named log.file.path. Try changing your if statement to use [log][file][path] instead of [source].
Glad to help. I am going to add this Beats-to-Logstash use-case to my list of future "how-to" videos (https://www.youtube.com/channel/UCivWvTx1DwrWNcDLV58kmOg). I use this method a lot, but have found there are a lot of questions about it.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.