# How to access input json message field?

**URL:** <https://discuss.elastic.co/t/how-to-access-input-json-message-field/128451>\
**Category:** Logstash\
**Created:** [April 18, 2018, 4:35am UTC](https://discuss.elastic.co/t/how-to-access-input-json-message-field/128451 "2018-04-18T04:35:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![RameshNagargoje](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rameshnagargoje/32/30212_2.png) [@RameshNagargoje](https://discuss.elastic.co/u/RameshNagargoje)\
**Post date:** [April 18, 2018, 4:35am UTC](https://discuss.elastic.co/t/how-to-access-input-json-message-field/128451/1 "2018-04-18T04:35:09Z")

</div>

Hi, i want to access type and logs field from input json

here is input json

{  
"type": "dmesg",  
"hostName": "ramesh-nagargoje",  
"os": "windo",  
"bseid": 1234,  
"logs": "[0.000000] Initializing cgroup subsys cpuset\n[0.000000] Initializing cgroup subsys cpu\n[0.000000] Initializing cgroup subsys cpuacct\n[0.000000] Linux version 3.13.0-144-generic (buildd@lgw01-amd64-059)"  
}

and here is config file i have used but i am not getting how to access type and log field from input message.

input  
{  
kafka  
{

```
       }

```

}  
filter  
{

```
    #json
    #{
    # source => "message"
    # target => "message"
    #}

    if [message][type] == 'dmesg'
    {
            mutate
            {
                    add_field => {"tag"=>"tagname"}
            }
    }

```

}

output  
{  
stdout  
{  
codec=\> json  
}  
}

---

<div class="post-metadata">

**Author:** ![RameshNagargoje](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rameshnagargoje/32/30212_2.png) [@RameshNagargoje](https://discuss.elastic.co/u/RameshNagargoje)\
**Post date:** [April 18, 2018, 4:36am UTC](https://discuss.elastic.co/t/how-to-access-input-json-message-field/128451/2 "2018-04-18T04:36:56Z")

</div>

@magnusbaeck please help

---

<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:** [May 16, 2018, 4:37am UTC](https://discuss.elastic.co/t/how-to-access-input-json-message-field/128451/3 "2018-05-16T04:37:12Z")

</div>

Closed on May 16, 2018, 4:37am UTC

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