Get year month and day from date field

hi
my csv data -
"s1","salesman01","2017-06-22 00:00:00.000","2017-06-22 16:10:23.000","2017-06-22 16:11:44.000","5","25.252130,55.349060"
i want to create new field which will call computeid for that i used this -
mutate { add_field => { "salesid" => "%{SalesmanCode} %{VisitDate}" } }

result is - "s4 2017-06-22T12:00:00.000Z"
but i want data in this format -> "s420170622" means year ,month and day from visit date
how can i get that ,any suggestion .
thanks

ok i got it working

 grok {
    match => { "VisitDate" => "(?<dateid>[0-9]{4}\-[0-9]{2}\-[0-9]{2})"}
  }
  
  grok {
  match => { "VisitDate" => "(?<indexid>[0-9]{4}\-[0-9]{2})"}
}


    
  
  mutate {
  gsub => ["dateid","-",""]
  gsub => ["indexid","-",""]
  
  add_field => { "[@metadata][indexid]" => "%{indexid}" }
  add_field => {
    "salesid" => "%{SalesmanCode}%{dateid}"
  }
   remove_field => [ "dateid","indexid" ]
}

if there is any other way , so am happy to learn .

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