logzio / docker-collector-logs

Apache License 2.0
16 stars 12 forks source link

Different type per container #7

Open teggno opened 5 years ago

teggno commented 5 years ago

Currently, a type can be specified using the LOGZIO_TYPE environment variable. It would be nice if a different type could be configured for each container thats logs are collected with the docker-collector-logs container.

For example, on the same docker host I'm running two containers, one node container running a web API with custom logging and an nginx container with its default logging. It would be nice to collect the logs of both of them but with different types as their log formats are different.

idohalevi commented 5 years ago

@teggno By default when the log gets to Logz.io we override the type value with the container image name

teggno commented 5 years ago

@idohalevi Thank you. For my overly simplified example, this would do. But I'm actually running more than just two containers on the host. Some of them share a common log format, some don't. There it would be useful to have container specific types. I could then configure something like:

idohalevi commented 5 years ago

@teggno So prefer you want the same type per two different images? Not against it just not sure it's needed. Can you explain the use case in logz.io where you would need two different types for different images and can't use docker.container.name instead?

teggno commented 5 years ago

@idohalevi It's because the "Data Parsing" feature of logz.io is using the type field. I could of course just have the LOGZIO_TYPE variable empty and thus get the container name as type but then I'd have to configure the same "Data Parsing" multiple times. This is of course not that big a problem but still.