Skip to content

Commit

Permalink
Merge pull request #535 from splunk/fix/use-host-not-fqdn-in-dns
Browse files Browse the repository at this point in the history
Update fix_dns.conf
  • Loading branch information
Ryan Faircloth authored and GitHub committed Jun 17, 2020
2 parents e68fd7e + 222feba commit b44a72e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion package/etc/conf.d/conflib/_splunk/fix_dns.conf
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ class FixHostResolver(object):

resolved = socket.gethostbyaddr(ipaddr)
hostname = resolved[0]
log_message['HOST'] = hostname
name, ext = hostname.split('.')[-2:]
log_message['HOST'] = name
except:
pass

Expand Down
2 changes: 1 addition & 1 deletion tests/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def test_fix_dns(record_property, setup_wordlist, setup_splunk, setup_sc4s):

sendsingle(message, setup_sc4s[0], setup_sc4s[1][514])

st = env.from_string("search _time={{ epoch }} host=dns.google index=osnix \"[{{ pid }}]\" {{ host }} sourcetype=\"nix:syslog\"")
st = env.from_string("search _time={{ epoch }} host=dns index=osnix \"[{{ pid }}]\" {{ host }} sourcetype=\"nix:syslog\"")
search = st.render(epoch=epoch, pid=pid, host=host)

resultCount, eventCount = splunk_single(setup_splunk, search)
Expand Down

0 comments on commit b44a72e

Please sign in to comment.