logspout icon indicating copy to clipboard operation
logspout copied to clipboard

Multiple values for filter.name

Open garceri opened this issue 8 years ago • 5 comments

Is it possible to pass multiple container name patterns on filter.name ?

garceri avatar Nov 07 '17 19:11 garceri

It doesn't seem like it:

syslog+tcp://localhost:7651?filter.name=boring_dijkstra%2Cvigorous_haibt

Only seems to send logs for the first container in the list.

The only example is this:

raw://192.168.10.10:5000?filter.name=*_db

Does this mean it supports all regular expressions? Or just simple pattern-matching? Clearer documentation would be a big help here.

timwebster9 avatar Nov 30 '17 10:11 timwebster9

Any news?

mahnunchik avatar May 27 '18 14:05 mahnunchik

Actually, logspout supports several container name filters. Just use several endpoints. See example for k8s: https://github.com/gliderlabs/logspout/issues/404#issuecomment-404111589

I don't like this way — because you need to repeat endpoint details, and in general this way is very not intuitive. I even prepared PR https://gist.github.com/develar/fdba772411cb2391f466a8723982c772 but did't send it because realised that currently logspout filter.labels works in a way that container must match ALL specified label filers. As user, I expect OR, but logspout currently uses AND. Decided for now just use several endpoints.

I am going to send PR to document how to use logspout with k8s.

develar avatar Jul 11 '18 09:07 develar

@develar This PR is what we want, which does not conflict with label management, and allows developers to choose which way to use, so the greatest benefit is that it does not need to change the target containers that you want to record.

tongv avatar Jul 17 '18 09:07 tongv

@tongv As commented, nothing prevent you to use multiple file name filter, please see https://github.com/gliderlabs/logspout/issues/404#issuecomment-404111589

Example (for kubernetes (rancher 2.0), as Docker Swarm is not good for production): syslog://logsN.papertrailapp.com:N?filter.name=k8s_YOUR_CONTAINER_NAME1_*,syslog://logsN.papertrailapp.com:N?filter.name=k8s_YOUR_CONTAINER_NAME2_*

develar avatar Jul 17 '18 09:07 develar