Remove HTML markup from logstash input

£可爱£侵袭症+ 提交于 2020-07-22 11:57:11

问题


I am struggling with data manipulation in logstash version 5.1, where some of the data come from open text fields with HTML markups. Most of the time it comes with only one marker, like this:

<.p> XYZ <./p>

and I am dealing with it using Grok.

but when it comes like this:

<.p><.b><.strong> XYZ <./strong><./b><./p>

simple grok cant filter it out.

My question is if there is a built-in filter for HTML markup or do i have to develop my own using regular expressions? Or do you know if in versions prior 5.1 is it possible ?


回答1:


To remove the HTML, you can use this:

mutate {  
  gsub => [
    "fieldname", "<.*?>", ""
  ]
}


来源:https://stackoverflow.com/questions/48424741/remove-html-markup-from-logstash-input

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!