Skip to content

Instantly share code, notes, and snippets.

@Tombar
Created December 9, 2013 22:26
Show Gist options
  • Save Tombar/7882116 to your computer and use it in GitHub Desktop.
Save Tombar/7882116 to your computer and use it in GitHub Desktop.
logstash remove fields with mutate filter
mutate {
remove_field => ['geoip.areacode', 'geoip.continent_code', 'geoip.country_code3', 'geoip.country_name', 'geoip.dma_code',
'geoip.latitude', 'geoip.longitude', 'geoip.postal_code', 'geoip.real_region_name',
'ua.minor', 'ua.major', 'ua.os_minor', 'ua.os_major', 'ua.patch', 'ua.os_name' ]
}
@Tombar
Copy link
Author

Tombar commented Dec 9, 2013

FTR, to get it to work with a JSON hierarchy, fields must be defined with the following notation

mutate {
remove_field => [ '[geoip][continent_code]', '[geoip][country_code3]', '[geoip][country_name]', '[geoip][dma_code]', '[geoip][ip]',
'[geoip][latitude]', '[geoip][longitude]', '[geoip][postal_code]', '[geoip][real_region_name]', '[geoip][area_code]',
'[ua][minor]', '[ua][major]', '[ua][os_minor]', '[ua][os_major]', '[ua][patch]' ]

}

@ppeble
Copy link

ppeble commented Jun 14, 2022

Just wanted to say that the last comment solved my json hierarchy problem after days of fighting with it. Thank you!

@Tombar
Copy link
Author

Tombar commented Jun 14, 2022

glad this helped you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment