Closed KieranOBrien-R7 closed 8 years ago
I don't think that passing regexps from the CLI is supported, you might want to send a PR for that :).
Hi,
I'm using the docker terminal setting up a container which follows the --matchByImage tags but they don't seem to work. Issue here with the Docker-Logentries which you created, https://github.com/logentries/docker-logentries/issues/38
Also what do you mean with "PR" ?
Thanks,
Pull Request :)
@mcollina I'm no node expert, but doesn't this suggest that matchByImage
and the other opts are passed in via command line?
https://github.com/mcollina/docker-allcontainers/blob/master/allcontainers.js#L161
I need this via @KieranOBrien-R7 's https://github.com/logentries/docker-logentries/issues/38 and am happy to help.
@bloo yes you are right, all those options are passed via command line.
The format is a JS regexp, anything between the two /
, i.e. /.*hello$/
would need to passed in as .*hello$
.
@mcollina I'm passing in: --skipByImage .*exechealthz.*
so that I can avoid recording logs for the exechealthz
images that run in my cluster, but those logs are still recorded. Do you have unit tests for these flags?
There are no unit tests, as I do not think testing against mocks is useful. Anyway, PRs are always welcome.
If you pass in --skipByImage .*exechealthz
you need to make sure that the *
is escaped, or it will be interpreted by bash, something like --skipByImage '.*exechealthz'
.
@mcollina - I'm using @KieranOBrien-R7 's node module https://github.com/logentries/docker-logentries using the following args:
-t 6d642718-5c7c-41e4-ae92-6ded504944f3 --no-stats --no-dockerEvents --skipByImage '.*exechealthz.*'
Adding these lines:
console.log("Skip By Image: " + skipByImage)
console.log("Is RegExp? " + (skipByImage instanceof RegExp))
to your script here https://github.com/mcollina/docker-allcontainers/blob/master/allcontainers.js#L21
prints out:
Skip By Image: /.*exechealthz.*/
Is RegExp? true
but it still does not filter out the output from that container. Thoughts?
I just tested this, and it works correctly on the cli and via the logentries container.
https://github.com/logentries/docker-logentries/issues/38#issuecomment-217816731
The command is this:
-t $LOGENTRIES_TOKEN -j -a host=
uname -n--no-stats --matchByImage='.*uniq_name*.'
note however that docker events (container up and down) are still sent to logentries for all containers, but the log output from the matched / skipped containers is handled correctly.
I agree with @AdrianRossouw, thanks for checking! I am closing this issue, please reopen with more details if needed.
I am trying to get the following to work to limit the logs to a single container based on a unique image name and nothing seems to work. No matter how I format the regex value the agent still seems to send logs from all running containers to logentries. I have tried:
--matchByImage '/_.uniq_imgname./' --matchByImage '/.uniq_img_name./' --matchByImage '.uniq_img_name.' --matchByImage 'uniq_img_name'
I know the last one is not valid regex but i tried anyways incase it's using some nonstandard wildcard syntax. Can you please show us some examples of how this is supposed to be formatted?