-
Notifications
You must be signed in to change notification settings - Fork 679
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Settings hostname for Kubernetes pods #176
Comments
You can pass parameters as in the routesapi using query params and set SYSLOG variables as environment variables. So if you want to only collects logs from containers named "application" and marks those in papertail as hostname start logspout container as
Also stay tuned on the PR that add env vars on SYSLOG_TAG template. |
@filipegiusti thanks for the reply! However I'm afraid this is not going to solve my problem. The underlying cause is that I'm running one logspout containers to collect data from many different applications each running in their own docker-container. Hence if I would do what you suggested I would get all my logs tagged as being from the same application although they are not :( |
I solved that using namespaces, not sure if that fits your environment. - name: SYSLOG_HOSTNAME
value: '{{ index .Container.Config.Labels "io.kubernetes.pod.namespace" }}' on that same idea you can set a name per Papertail program as an environment variable as - name: SYSLOG_TAG
value: '{{ index .Container.Config.Env "PROGRAM_NAME" }}' I spend a lot of time reading logspout source to keep that information to myself. 😄 |
In case somebody else is running a Kubernetes cluster using Rancher. The following configuration works well for me:
The only issue is that containers deployed by Rancher (e.g. rancher/agent) are logged with their container id instead of a more descriptive name. |
Seems like there are multiple ways to specify this from your cluster implementation of choice. Closing. |
syslog: template: syslog:1:67: executing "syslog" at <index .Container.Con...>: error calling index: cannot index slice/array with type string |
@mmoore0011 if you're filing an issue about a bug, please open a new issue. Do not resurrect an old issue that was closed 2 years ago. |
Hey,
I'm running logspout as a DaemonSet inside my Kubernetes cluster. Those containers are successfully set up to send the stdout and stderr from my pods to Papertrail. However when I see the logs coming in the "program" field (e.g. the "name") is pretty verbose and contains a lot of randomly generated UUID on a per-deployment-basis.
Is there any way I could teach logspout to use a static name per pod which I could use?
The text was updated successfully, but these errors were encountered: