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 mongodb log type for kubernetes and file input sources #302

Merged
merged 2 commits into from
Aug 11, 2021

Conversation

jsirianni
Copy link
Member

When using mongodb on kubernetes, the wrong log type label is applied. This is because it was only being set at the file input operator. I have removed this, and added an add operator to the end of the pipeline. This way, the log type is added regardless of the log source (kubernetes or file input).

before: "log_type": "k8s.container",

{
  "timestamp": "2021-08-11T14:50:57.323Z",
  "severity": 30,
  "severity_text": "I",
  "labels": {
    "k8s-ns/kubernetes.io/metadata.name": "default",
    "k8s-pod/app": "mongo",
    "k8s-pod/pod-template-hash": "55457b675",
    "log_type": "k8s.container",
    "plugin_id": "kubernetes_input",
    "stream": "stdout"
  },
  "resource": {
    "k8s.cluster.name": "stanza_example",
    "k8s.container.id": "c338a244244005d88db8e434b762c939b94102cab7babba57980b4f247b5aae1",
    "k8s.container.name": "wordpress",
    "k8s.deployment.name": "mongodb",
    "k8s.namespace.name": "default",
    "k8s.namespace.uid": "f0d2a872-ea9c-4ca6-a92e-b31571bc76d7",
    "k8s.node.name": "",
    "k8s.pod.name": "mongodb-55457b675-79t5q",
    "k8s.pod.uid": "3ca4719b-7368-4fd8-93db-d625429719ea",
    "k8s.replicaset.name": "mongodb-55457b675"
  },
  "record": {
    "attr": {},
    "component": "STORAGE",
    "context": "Checkpointer",
    "id": 22430,
    "message": "[1628693457:323919][1:0x7f756da2f700], WT_SESSION.checkpoint: [WT_VERB_CHECKPOINT_PROGRESS] saving checkpoint snapshot min: 11, snapshot max: 11 snapshot count: 0, oldest timestamp: (0, 0) , meta checkpoint timestamp: (0, 0) base write gen: 7",
    "message_type": "WiredTiger message"
  }
}

after: "log_type": "mongodb",

{
  "timestamp": "2021-08-11T16:10:35.778Z",
  "severity": 30,
  "severity_text": "I",
  "labels": {
    "k8s-ns/kubernetes.io/metadata.name": "default",
    "k8s-pod/app": "mongo",
    "k8s-pod/pod-template-hash": "55457b675",
    "log_type": "mongodb",
    "plugin_id": "kubernetes_input",
    "stream": "stdout"
  },
  "resource": {
    "k8s.cluster.name": "stanza_example",
    "k8s.container.id": "2847c455791fa59a95eb8421dfa4e0205ec540196148a88aed3391b3159654e9",
    "k8s.container.name": "wordpress",
    "k8s.deployment.name": "mongodb",
    "k8s.namespace.name": "default",
    "k8s.namespace.uid": "f0d2a872-ea9c-4ca6-a92e-b31571bc76d7",
    "k8s.node.name": "",
    "k8s.pod.name": "mongodb-55457b675-hkqvj",
    "k8s.pod.uid": "ce262204-49b1-4360-b159-729b6f2334cb",
    "k8s.replicaset.name": "mongodb-55457b675"
  },
  "record": {
    "attr": {},
    "component": "STORAGE",
    "context": "Checkpointer",
    "id": 22430,
    "message": "[1628698235:778708][1:0x7f66684e9700], WT_SESSION.checkpoint: [WT_VERB_CHECKPOINT_PROGRESS] saving checkpoint snapshot min: 5, snapshot max: 5 snapshot count: 0, oldest timestamp: (0, 0) , meta checkpoint timestamp: (0, 0) base write gen: 7",
    "message_type": "WiredTiger message"
  }
}

@jsirianni jsirianni marked this pull request as ready for review August 11, 2021 16:15
Copy link
Contributor

@BinaryFissionGames BinaryFissionGames left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@jsirianni jsirianni merged commit 3a5d363 into master Aug 11, 2021
@jsirianni jsirianni deleted the mongodb-log-type branch August 11, 2021 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants