# Script Processor

**URL:** <https://discuss.elastic.co/t/script-processor/216552>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [January 26, 2020, 1:44am UTC](https://discuss.elastic.co/t/script-processor/216552 "2020-01-26T01:44:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rithesh\_Subramanian](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rithesh_subramanian/32/61436_2.png) [@Rithesh\_Subramanian](https://discuss.elastic.co/u/Rithesh_Subramanian)\
**Post date:** [January 26, 2020, 1:44am UTC](https://discuss.elastic.co/t/script-processor/216552/1 "2020-01-26T01:44:45Z")

</div>

Hi,  
I am trying to add script processor after splitting the message with dissect processor.  
But i am not able to start the filebeat after adding the script processor.

```
processors:
 - rename:
      fields:
        - from: "message"
          to: "data"
 - dissect:
     tokenizer: "TID: [%{ts}] %{lvl} %{TEST} [%{mesID}] {%{class}} [%{message}]"
     field: "data"
     target_prefix: ""

 - drop_fields:
            fields: ["data","class"]

 - script:
    lang: javascript
    id: my_filter
    source: >
                    function process(event) {
                    event.Tag("js");
            }

```

and I am getting the following error while starting the filebeat.

```
Exiting: error loading config file: yaml: line 37: did not find expected key

```

line 37 in my config file points to

```
event.Tag("js");

```

Thanks in advance

---

<div class="post-metadata">

**Author:** ![ChrsMark](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chrsmark/32/55858_2.png) [@ChrsMark](https://discuss.elastic.co/u/ChrsMark)\
**Post date:** [January 27, 2020, 10:08am UTC](https://discuss.elastic.co/t/script-processor/216552/2 "2020-01-27T10:08:25Z")

</div>

Hi!

Looks like YAML issues:

1. `processors` key is missing from your config.
2. indentation is not correct.

Here a valid yaml you could use:

```auto
filebeat.yml:
filebeat.config:
  prospectors:
    # Mounted `filebeat-prospectors` configmap:
    path: ${path.config}/prospectors.d/*.yml
    # Reload prospectors configs as they change:
    reload.enabled: false
  modules:
    path: ${path.config}/modules.d/*.yml
    # Reload module configs as they change:
    reload.enabled: false
  filebeat.autodiscover:
    providers:
     - type: docker
       templates:
         - condition:
             equals:
               docker.container.labels.io.kubernetes.container.name: "nginx-ingress-controller"
           config:
             - module: nginx
               access:
                 input:
                   type: docker
                   containers.stream: stdoutprocessors:
  processors:
     - rename:
          fields:
            - from: "message"
              to: "data"
     - dissect:
         tokenizer: "TID: [%{ts}] %{lvl} %{TEST} [%{mesID}] {%{class}} [%{message}]"
         field: "data"
         target_prefix: ""
    
     - drop_fields:
                fields: ["data","class"]
    
     - script:
        lang: javascript
        id: my_filter
        source: >
            function process(event) {
                event.Tag("js");
            }

```

---

<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:** [February 24, 2020, 10:08am UTC](https://discuss.elastic.co/t/script-processor/216552/3 "2020-02-24T10:08:26Z")

</div>

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