Skip to content
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

add support for k8s_container resource type #206

Closed
suraj-qlogic opened this issue Aug 4, 2020 · 1 comment · Fixed by #207
Closed

add support for k8s_container resource type #206

suraj-qlogic opened this issue Aug 4, 2020 · 1 comment · Fixed by #207
Assignees
Labels
api: logging Issues related to the googleapis/java-logging API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@suraj-qlogic
Copy link
Contributor

suraj-qlogic commented Aug 4, 2020

When setting the k8s_container resource type in logbak.xml,it doesn't fill in any of the resource labels associated with it.

logback.xml

<configuration>
    <appender name="CLOUD" class="com.google.cloud.logging.logback.LoggingAppender">
        <!-- Optional : filter logs at or above a level -->
        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
            <level>INFO</level>
        </filter>
        <log>my-log-test</log> <!-- Optional : default java.log -->
        <resourceType>k8s_container</resourceType>
        <flushLevel>WARN</flushLevel> <!-- Optional : default ERROR -->
    </appender>
    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
        </encoder>
    </appender>
    <root level="debug">
        <appender-ref ref="CLOUD"/>
        <appender-ref ref="STDOUT"/>
    </root>
</configuration>

output:

resource: {
  type: "k8s_container"
  labels: {
    cluster_name: ""
    pod_name: ""
    container_name: ""
    namespace_name: ""
    location: ""
    project_id: "XXX"
   }
}
@product-auto-label product-auto-label bot added the api: logging Issues related to the googleapis/java-logging API. label Aug 4, 2020
@suraj-qlogic suraj-qlogic self-assigned this Aug 4, 2020
@suraj-qlogic suraj-qlogic added the type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. label Aug 4, 2020
@simonz130 simonz130 added the priority: p2 Moderately-important priority. Fix may not be included in next release. label Dec 9, 2020
@Red-C
Copy link

Red-C commented Feb 6, 2021

Hi! thanks for merging the pr and supporting the k8s_container. the container name is still incorrect in our logs. what's the consideration of using prefix of hostname as the container name?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: logging Issues related to the googleapis/java-logging API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants