# New to Logstash and Pugins - Can anyone help?

**URL:** <https://discuss.elastic.co/t/new-to-logstash-and-pugins-can-anyone-help/111726>\
**Category:** Logstash\
**Created:** [December 14, 2017, 9:42am UTC](https://discuss.elastic.co/t/new-to-logstash-and-pugins-can-anyone-help/111726 "2017-12-14T09:42:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hmpmarketing](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hmpmarketing/32/44892_2.png) [@hmpmarketing](https://discuss.elastic.co/u/hmpmarketing)\
**Post date:** [December 14, 2017, 9:42am UTC](https://discuss.elastic.co/t/new-to-logstash-and-pugins-can-anyone-help/111726/1 "2017-12-14T09:42:09Z")

</div>

Hi everyone, Im just got started with logstash and having a hard time understanding how I should setup a pipeline.

I am sending from my app a json encoded string that is getting stored in a redis list, my objetive is to send this data to ES, however within the json string there is a field storing the user agent of the request. Below is my attempt at a config and what I am trying to achieve:

```
###### My logstash config attempt #########

```

> ```
> input {
> redis {
> host => "127.0.0.1"
> data_type => "list"
> key => "logstash"
> }
> ####No clue what to do with the json string from list! ###  
> filter {
> useragent {
> source => ""
> }
>   
> output {
> elasticsearch {
> hosts => "http://es.myserver.com"
> action => "index"
> index => "logstash-%{+YYYY.MM.dd}-adserver3-stats"
> } 
>   
> }
> 
> ```

####### sample json stored on redis "logstash" list #######

> {  
> "campaign\_id": "2071",  
> "user\_country": "GB",  
> "user\_city\_state": "LondonENG",  
> "isp\_name": "BT",  
> "ip\_address": "109.145.148.78",  
> "user\_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 11\_1\_2 like Mac OS X) AppleWebKit/604.3.5 (KHTML, like Gecko) Mobile/15B202",  
> "type": "adserver3-stats"  
> }

################ How do I process the user\_agent so that I end up with this to send to Elasticsearch? ##################

> {  
> "campaign\_id": "2071",  
> "user\_country": "GB",  
> "user\_city\_state": "LondonENG",  
> "isp\_name": "BT",  
> "ip\_address": "109.145.148.78",  
> "user\_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 11\_1\_2 like Mac OS X) AppleWebKit/604.3.5 (KHTML, like Gecko) Mobile/15B202",  
> "name": "Mobile Safari",  
> "os": "iOS 11.1.2",  
> "device": "iPhone"  
> "type": "adserver3-stats"  
> }

Can anyone help? Thank you again

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [December 14, 2017, 11:44am UTC](https://discuss.elastic.co/t/new-to-logstash-and-pugins-can-anyone-help/111726/2 "2017-12-14T11:44:04Z")

</div>

```nohighlight
input {
  redis {
    ...
    codec => json
  }
}
filter {
  useragent {
    source => "user_agent"
  }
}

```

---

<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:** [January 11, 2018, 11:44am UTC](https://discuss.elastic.co/t/new-to-logstash-and-pugins-can-anyone-help/111726/3 "2018-01-11T11:44:15Z")

</div>

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