# How to index a .json file located inside a persistent volume on a kubernetes cluster to Elasticsearch

**URL:** <https://discuss.elastic.co/t/how-to-index-a-json-file-located-inside-a-persistent-volume-on-a-kubernetes-cluster-to-elasticsearch/284830>\
**Category:** Beats\
**Tags:** beats-module, filebeat\
**Created:** [September 22, 2021, 9:28am UTC](https://discuss.elastic.co/t/how-to-index-a-json-file-located-inside-a-persistent-volume-on-a-kubernetes-cluster-to-elasticsearch/284830 "2021-09-22T09:28:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jad\_Sakr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jad_sakr/32/94901_2.png) [@Jad\_Sakr](https://discuss.elastic.co/u/Jad_Sakr)\
**Post date:** [September 22, 2021, 9:28am UTC](https://discuss.elastic.co/t/how-to-index-a-json-file-located-inside-a-persistent-volume-on-a-kubernetes-cluster-to-elasticsearch/284830/1 "2021-09-22T09:28:50Z")

</div>

I have a code that collects data and dumps it in a .json file. In this file, every line is a json object. I was following this guide` https://www.elastic.co/guide/en/cloud-on-k8s/current/index.html` to run Elastic on kubernetes.  
MY QUESTION:  
I have a .json file inside a persistent volume path. I just want to get the data inside this file, indexed in Elasticsearch. All examples i'm seeing are for indexing the logs of containers ..

any help please ?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [September 22, 2021, 9:34am UTC](https://discuss.elastic.co/t/how-to-index-a-json-file-located-inside-a-persistent-volume-on-a-kubernetes-cluster-to-elasticsearch/284830/2 "2021-09-22T09:34:04Z")

</div>

Welcome to our community! 😃

You will need to mount the persistent volume inside the pod and then tell Filebeat to read from that.

---

<div class="post-metadata">

**Author:** ![Jad\_Sakr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jad_sakr/32/94901_2.png) [@Jad\_Sakr](https://discuss.elastic.co/u/Jad_Sakr)\
**Post date:** [September 22, 2021, 9:53am UTC](https://discuss.elastic.co/t/how-to-index-a-json-file-located-inside-a-persistent-volume-on-a-kubernetes-cluster-to-elasticsearch/284830/3 "2021-09-22T09:53:33Z")

</div>

Hello Mark, thanks for helping.  
Logically, that's the way to solve it. But if that's the yaml file i'm using for indexing the logs, what should I change to index my file.

```auto
apiVersion: beat.k8s.elastic.co/v1beta1
kind: Beat
metadata:
  name: quickstart
spec:
  type: filebeat
  version: 7.14.1
  elasticsearchRef:
    name: quickstart
  config:
    filebeat.inputs:
    - type: container
      paths:
      - /var/log/containers/*.log
  daemonSet:
    podTemplate:
      spec:
        dnsPolicy: ClusterFirstWithHostNet
        hostNetwork: true
        securityContext:
          runAsUser: 0
        containers:
        - name: filebeat
          volumeMounts:
          - name: varlogcontainers
            mountPath: /var/log/containers
          - name: varlogpods
            mountPath: /var/log/pods
          - name: varlibdockercontainers
            mountPath: /var/lib/docker/containers
        volumes:
        - name: varlogcontainers
          hostPath:
            path: /var/log/containers
        - name: varlogpods
          hostPath:
            path: /var/log/pods
        - name: varlibdockercontainers
          hostPath:
            path: /var/lib/docker/containers

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 20, 2021, 11:54am UTC](https://discuss.elastic.co/t/how-to-index-a-json-file-located-inside-a-persistent-volume-on-a-kubernetes-cluster-to-elasticsearch/284830/4 "2021-10-20T11:54:05Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
