In my Assets configuration, I have an “Enter multiple IP addresses” custom field. Today one of my users asked me if I could set it so that searches on that field did not have to be exact matches. This confused me because i was sure I had already done that, but sure enough, when we searched for “10.163.148.26”, we got a match, but when we searched for just “148.26” we didn’t.
I checked, and had in fact already set all of my $AssetSearchFields to “LIKE”. After some poking around in log files and the database I discovered that IPv4 addresses get zero-padded in the database (MySQL), so that all 4 pieces are 3 digits. So searching for “148.026” finds the system we were looking for.
I only have half a dozen or so users, so I’ve told them to add extra zeros as necessary when they’re searching IP addresses, but …
We do get a match when we search for the whole IP, even though the leading zero is there in the database. Can the search be programmed to ignore them on searches of partial IPs, as well? Where would I look to try to do that myself?