# Logstash... access field into field

**URL:** <https://discuss.elastic.co/t/logstash-access-field-into-field/20739>\
**Category:** Elasticsearch\
**Created:** [November 13, 2014, 10:20pm UTC](https://discuss.elastic.co/t/logstash-access-field-into-field/20739 "2014-11-13T22:20:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mAcK\_sAm](https://avatars.discourse-cdn.com/v4/letter/m/c6cbf5/32.png) [@mAcK\_sAm](https://discuss.elastic.co/u/mAcK_sAm)\
**Post date:** [November 13, 2014, 10:20pm UTC](https://discuss.elastic.co/t/logstash-access-field-into-field/20739/1 "2014-11-13T22:20:33Z")

</div>

Hi everyone, sorry about my English, I know a little.

I want to format into a file with message\_format, but I have this structure:

{  
"fields":  
{  
"level":"error",  
"role":"xmpp",  
"role\_version":"0.0.1",  
"node":"lager@host",  
"pid":"\<0.55.0\>"  
},  
"@timestamp":"2014-11-13T10:43:14.463-06:00",  
"message":"Error notice!!",  
"type":"erlang",  
"@version":"1",  
"host":"127.0.0.1"  
}

This is my logstash config file:

input {  
udp {  
type =\> "erlang"  
codec =\> "json"  
port =\> 9125  
}  
}

output {  
stdout {  
codec =\> json  
}  
file {  
path =\> "/home/erlang/logstash/erlang.log"  
message\_format =\> "%{@timestamp} %{type} %{message} %{host}  
%{level}"  
}  
}

I want to show the "level" field, How can I do that?... If I put %{level}  
on message\_format, on the log file logstash write "%{level}", no "error".

Thanks.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/71045377-ef01-49c2-80cf-886b61d2a4aa%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/71045377-ef01-49c2-80cf-886b61d2a4aa%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![mAcK\_sAm](https://avatars.discourse-cdn.com/v4/letter/m/c6cbf5/32.png) [@mAcK\_sAm](https://discuss.elastic.co/u/mAcK_sAm)\
**Post date:** [November 13, 2014, 11:31pm UTC](https://discuss.elastic.co/t/logstash-access-field-into-field/20739/2 "2014-11-13T23:31:55Z")

</div>

The answer:

> ```
> message_format => "%{@timestamp} %{type} %{message} 
> 
> ```
> 
> %{host} %{[fields][level]}"

Thanks!

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/61fa6311-33be-4daa-9344-fe5bacee3c9c%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/61fa6311-33be-4daa-9344-fe5bacee3c9c%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [July 6, 2017, 12:50am UTC](https://discuss.elastic.co/t/logstash-access-field-into-field/20739/3 "2017-07-06T00:50:02Z")

</div>


