Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Failed to render template for "index" #18260

Closed
gorbunov-di opened this issue Aug 15, 2023 · 1 comment
Closed

Failed to render template for "index" #18260

gorbunov-di opened this issue Aug 15, 2023 · 1 comment
Labels
type: bug A code related bug.

Comments

@gorbunov-di
Copy link

gorbunov-di commented Aug 15, 2023

A note for the community

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Problem

Hello. I periodically get an error:

{
  "_index": "vector-dev-2023-08-15",
  "_id": "p8of-4kB8-sMq-fMul89",
  "_version": 1,
  "_score": null,
  "_source": {
    "error": "Missing fields on event: [\".service_name\"]",
    "error_type": "template_failed",
    "host": "vector-j89tn",
    "internal_log_rate_limit": true,
    "message": "Failed to render template for \"index\".",
    "metadata": {
      "kind": "event",
      "level": "ERROR",
      "module_path": "vector::internal_events::template",
      "target": "vector::internal_events::template"
    },
    "pid": 1,
    "source_type": "internal_logs",
    "stage": "processing",
    "timestamp": "2023-08-15T21:35:06.829736905Z",
    "vector": {
      "component_id": "opensearch",
      "component_kind": "sink",
      "component_name": "opensearch",
      "component_type": "elasticsearch"
    }
  },
  "fields": {
    "timestamp": [
      "2023-08-15T21:35:06.829Z"
    ]
  },
  "sort": [
    1692135306829
  ]
}

But I can't catch an event where this field is not present. I catch through type: "filter".

Configuration

customConfig:
    data_dir: /var/lib/vector
    api:
    enabled: true
    address: 127.0.0.1:8686
    playground: false
    sources:
    k8s:
        type: kubernetes_logs
        exclude_paths_glob_patterns: ["*kube-system*"]
        extra_namespace_label_selector: vector.dev/logging=true
    transforms:
    k8s-remap:
        type: remap
        inputs: ["k8s"]
        source: |-
        kubernetes = {"service_namespace":(.kubernetes.pod_namespace), "service_name":(.kubernetes.container_name), "pod_name": (.kubernetes.pod_name), "@timestamp": (parse_timestamp!(.timestamp, format: "MMM D, YYYY @ HH:mm:ss.SSS"))}
        ., err = parse_json(.message)
        ., err = merge(., kubernetes)
        drop_on_error: true
        reroute_dropped: true
    k8s-reforge:
        type: remap
        inputs: ["*dropped"]
        source: |-
        ., err  = {"message": (to_string(.message)), "dropped": true, "service_namespace":(.kubernetes.pod_namespace), "service_name":(.kubernetes.container_name), "pod_name": (.kubernetes.pod_name), "metadata": (.metadata), "@timestamp": (parse_timestamp!(.timestamp, format: "MMM D, YYYY @ HH:mm:ss.SSS"))}
    exists-service-name:
      type: "filter"
      inputs: ["k8s-remap","k8s-reforge"]
      condition: 
        type: "vrl"
        source: |-
          !exists(.container_name)
    sinks:
    opensearch-debug:
        type: elasticsearch
        inputs: ["exists-service-name"]
        api_version: v8
        endpoints: ["elasticsearch"]
        bulk:
        index: "vector-debug-%Y-%m-%d"
    opensearch:
        type: elasticsearch
        inputs: ["k8s-remap","k8s-reforge"]
        api_version: v8
        endpoints: ["elasticsearch"]
        bulk:
        index: "dev-{{ .service_name }}-%Y-%m-%d" 


### Version

0.31.0

### Debug Output

_No response_

### Example Data

_No response_

### Additional Context

_No response_

### References

_No response_
@gorbunov-di gorbunov-di added the type: bug A code related bug. label Aug 15, 2023
@gorbunov-di
Copy link
Author

#17487
Same problem?

@vectordotdev vectordotdev locked and limited conversation to collaborators Aug 15, 2023
@jszwedko jszwedko converted this issue into discussion #18262 Aug 15, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
type: bug A code related bug.
Projects
None yet
Development

No branches or pull requests

1 participant