Re: Support for Kubernetes metadata when using docker --log-driver=journald?

2016-05-20 Thread Rich Megginson

On 05/20/2016 10:39 AM, Clayton Coleman wrote:

Actually, there may be an issue for this already.
https://github.com/kubernetes/kubernetes/issues/15478


I created a new issue: https://github.com/kubernetes/kubernetes/issues/25975



On Fri, May 20, 2016 at 12:38 PM, Clayton Coleman  wrote:

We could support setting that on the Kubelet when we launch the
containers.  I think it's reasonable - if you open a Kube issue Derek
and I can chime in.

On Fri, May 20, 2016 at 12:12 PM, Rich Megginson  wrote:

When using OpenShift with the standard docker log driver, there are
container logs in the following format:

/var/log/containers/$name_of_pod-$name_of_project-$name_of_container-$containeruuid.log

The fluentd log collector uses $name_of_pod and $name_of_project to look up
in k8s additional metadata for the pod and project (such as the uuids).

When using docker daemon --log-driver=journald, these files no longer exist,
and the journal entries are missing $name_of_pod and $name_of_project in the
metadata:

__CURSOR=s=7c08f275b8a545a9afb1770ef779ebb8;i=3148;b=caa653694cfa4a6ea9e4213e6cf4065b;m=13700ce9;t=53347368f6904;x=770aebf7b30ab7b3
__REALTIME_TIMESTAMP=1463755834616068
...
_COMM=docker-current
_EXE=/usr/bin/docker-current
_CMDLINE=/usr/bin/docker-current daemon
--authorization-plugin=rhel-push-plugin --selinux-enabled
--log-driver=journald
CONTAINER_ID=a160de6fe8fa
CONTAINER_ID_FULL=a160de6fe8facb49103c45f2bd14854b455b42153b777634ea58fb8a95124a40
CONTAINER_NAME=silly_bhaskara

When running containers via docker directly, you can use -e and -l to pass
additional metadata through to the journal output:
   docker run -e FOOT=BALL -l LA=SF --rm --name toasted \
   --log-driver=journald --log-opt env=FOOT --log-opt labels=LA \
   fedora /bin/pwd

  MESSAGE=/
  CONTAINER_NAME=toasted
  LA=SF
  FOOT=BALL
  CONTAINER_ID=37772f57b118

CONTAINER_ID_FULL=37772f57b1189306fed624675cd33412461a6f04ff0f4d7a4ea5d1d41f637641

Is there some way to make k8s and/or OpenShift add fields like
K8S_POD_NAME=$name_of_pod and
K8S_NAMESPACE_NAME=$name_of_project to the journal entries?
This will also be needed by
https://github.com/fabric8io/fluent-plugin-kubernetes_metadata_filter which
assumes the entries are tagged in a similar format to the filename above.
Of course if k8s/openshift can be configured to automatically add that
additional metadata to the journal entries then the fluentd k8s metadata
plugin might not be needed.


___
dev mailing list
dev@lists.openshift.redhat.com
http://lists.openshift.redhat.com/openshiftmm/listinfo/dev



___
dev mailing list
dev@lists.openshift.redhat.com
http://lists.openshift.redhat.com/openshiftmm/listinfo/dev


Re: Support for Kubernetes metadata when using docker --log-driver=journald?

2016-05-20 Thread Clayton Coleman
We could support setting that on the Kubelet when we launch the
containers.  I think it's reasonable - if you open a Kube issue Derek
and I can chime in.

On Fri, May 20, 2016 at 12:12 PM, Rich Megginson  wrote:
> When using OpenShift with the standard docker log driver, there are
> container logs in the following format:
>
> /var/log/containers/$name_of_pod-$name_of_project-$name_of_container-$containeruuid.log
>
> The fluentd log collector uses $name_of_pod and $name_of_project to look up
> in k8s additional metadata for the pod and project (such as the uuids).
>
> When using docker daemon --log-driver=journald, these files no longer exist,
> and the journal entries are missing $name_of_pod and $name_of_project in the
> metadata:
>
> __CURSOR=s=7c08f275b8a545a9afb1770ef779ebb8;i=3148;b=caa653694cfa4a6ea9e4213e6cf4065b;m=13700ce9;t=53347368f6904;x=770aebf7b30ab7b3
> __REALTIME_TIMESTAMP=1463755834616068
> ...
> _COMM=docker-current
> _EXE=/usr/bin/docker-current
> _CMDLINE=/usr/bin/docker-current daemon
> --authorization-plugin=rhel-push-plugin --selinux-enabled
> --log-driver=journald
> CONTAINER_ID=a160de6fe8fa
> CONTAINER_ID_FULL=a160de6fe8facb49103c45f2bd14854b455b42153b777634ea58fb8a95124a40
> CONTAINER_NAME=silly_bhaskara
>
> When running containers via docker directly, you can use -e and -l to pass
> additional metadata through to the journal output:
>   docker run -e FOOT=BALL -l LA=SF --rm --name toasted \
>   --log-driver=journald --log-opt env=FOOT --log-opt labels=LA \
>   fedora /bin/pwd
>
>  MESSAGE=/
>  CONTAINER_NAME=toasted
>  LA=SF
>  FOOT=BALL
>  CONTAINER_ID=37772f57b118
>
> CONTAINER_ID_FULL=37772f57b1189306fed624675cd33412461a6f04ff0f4d7a4ea5d1d41f637641
>
> Is there some way to make k8s and/or OpenShift add fields like
> K8S_POD_NAME=$name_of_pod and
> K8S_NAMESPACE_NAME=$name_of_project to the journal entries?
> This will also be needed by
> https://github.com/fabric8io/fluent-plugin-kubernetes_metadata_filter which
> assumes the entries are tagged in a similar format to the filename above.
> Of course if k8s/openshift can be configured to automatically add that
> additional metadata to the journal entries then the fluentd k8s metadata
> plugin might not be needed.
>
>
> ___
> dev mailing list
> dev@lists.openshift.redhat.com
> http://lists.openshift.redhat.com/openshiftmm/listinfo/dev
>

___
dev mailing list
dev@lists.openshift.redhat.com
http://lists.openshift.redhat.com/openshiftmm/listinfo/dev


Re: Support for Kubernetes metadata when using docker --log-driver=journald?

2016-05-20 Thread Clayton Coleman
Actually, there may be an issue for this already.
https://github.com/kubernetes/kubernetes/issues/15478

On Fri, May 20, 2016 at 12:38 PM, Clayton Coleman  wrote:
> We could support setting that on the Kubelet when we launch the
> containers.  I think it's reasonable - if you open a Kube issue Derek
> and I can chime in.
>
> On Fri, May 20, 2016 at 12:12 PM, Rich Megginson  wrote:
>> When using OpenShift with the standard docker log driver, there are
>> container logs in the following format:
>>
>> /var/log/containers/$name_of_pod-$name_of_project-$name_of_container-$containeruuid.log
>>
>> The fluentd log collector uses $name_of_pod and $name_of_project to look up
>> in k8s additional metadata for the pod and project (such as the uuids).
>>
>> When using docker daemon --log-driver=journald, these files no longer exist,
>> and the journal entries are missing $name_of_pod and $name_of_project in the
>> metadata:
>>
>> __CURSOR=s=7c08f275b8a545a9afb1770ef779ebb8;i=3148;b=caa653694cfa4a6ea9e4213e6cf4065b;m=13700ce9;t=53347368f6904;x=770aebf7b30ab7b3
>> __REALTIME_TIMESTAMP=1463755834616068
>> ...
>> _COMM=docker-current
>> _EXE=/usr/bin/docker-current
>> _CMDLINE=/usr/bin/docker-current daemon
>> --authorization-plugin=rhel-push-plugin --selinux-enabled
>> --log-driver=journald
>> CONTAINER_ID=a160de6fe8fa
>> CONTAINER_ID_FULL=a160de6fe8facb49103c45f2bd14854b455b42153b777634ea58fb8a95124a40
>> CONTAINER_NAME=silly_bhaskara
>>
>> When running containers via docker directly, you can use -e and -l to pass
>> additional metadata through to the journal output:
>>   docker run -e FOOT=BALL -l LA=SF --rm --name toasted \
>>   --log-driver=journald --log-opt env=FOOT --log-opt labels=LA \
>>   fedora /bin/pwd
>>
>>  MESSAGE=/
>>  CONTAINER_NAME=toasted
>>  LA=SF
>>  FOOT=BALL
>>  CONTAINER_ID=37772f57b118
>>
>> CONTAINER_ID_FULL=37772f57b1189306fed624675cd33412461a6f04ff0f4d7a4ea5d1d41f637641
>>
>> Is there some way to make k8s and/or OpenShift add fields like
>> K8S_POD_NAME=$name_of_pod and
>> K8S_NAMESPACE_NAME=$name_of_project to the journal entries?
>> This will also be needed by
>> https://github.com/fabric8io/fluent-plugin-kubernetes_metadata_filter which
>> assumes the entries are tagged in a similar format to the filename above.
>> Of course if k8s/openshift can be configured to automatically add that
>> additional metadata to the journal entries then the fluentd k8s metadata
>> plugin might not be needed.
>>
>>
>> ___
>> dev mailing list
>> dev@lists.openshift.redhat.com
>> http://lists.openshift.redhat.com/openshiftmm/listinfo/dev
>>

___
dev mailing list
dev@lists.openshift.redhat.com
http://lists.openshift.redhat.com/openshiftmm/listinfo/dev


Support for Kubernetes metadata when using docker --log-driver=journald?

2016-05-20 Thread Rich Megginson
When using OpenShift with the standard docker log driver, there are 
container logs in the following format:


/var/log/containers/$name_of_pod-$name_of_project-$name_of_container-$containeruuid.log

The fluentd log collector uses $name_of_pod and $name_of_project to look 
up in k8s additional metadata for the pod and project (such as the uuids).


When using docker daemon --log-driver=journald, these files no longer 
exist, and the journal entries are missing $name_of_pod and 
$name_of_project in the metadata:


__CURSOR=s=7c08f275b8a545a9afb1770ef779ebb8;i=3148;b=caa653694cfa4a6ea9e4213e6cf4065b;m=13700ce9;t=53347368f6904;x=770aebf7b30ab7b3
__REALTIME_TIMESTAMP=1463755834616068
...
_COMM=docker-current
_EXE=/usr/bin/docker-current
_CMDLINE=/usr/bin/docker-current daemon 
--authorization-plugin=rhel-push-plugin --selinux-enabled 
--log-driver=journald

CONTAINER_ID=a160de6fe8fa
CONTAINER_ID_FULL=a160de6fe8facb49103c45f2bd14854b455b42153b777634ea58fb8a95124a40
CONTAINER_NAME=silly_bhaskara

When running containers via docker directly, you can use -e and -l to 
pass additional metadata through to the journal output:

  docker run -e FOOT=BALL -l LA=SF --rm --name toasted \
  --log-driver=journald --log-opt env=FOOT --log-opt labels=LA \
  fedora /bin/pwd

 MESSAGE=/
 CONTAINER_NAME=toasted
 LA=SF
 FOOT=BALL
 CONTAINER_ID=37772f57b118
 
CONTAINER_ID_FULL=37772f57b1189306fed624675cd33412461a6f04ff0f4d7a4ea5d1d41f637641

Is there some way to make k8s and/or OpenShift add fields like 
K8S_POD_NAME=$name_of_pod and

K8S_NAMESPACE_NAME=$name_of_project to the journal entries?
This will also be needed by 
https://github.com/fabric8io/fluent-plugin-kubernetes_metadata_filter 
which assumes the entries are tagged in a similar format to the filename 
above.  Of course if k8s/openshift can be configured to automatically 
add that additional metadata to the journal entries then the fluentd k8s 
metadata plugin might not be needed.


___
dev mailing list
dev@lists.openshift.redhat.com
http://lists.openshift.redhat.com/openshiftmm/listinfo/dev