New to Logstash and Pugins - Can anyone help?

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

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

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