cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Need help querying everything related to a DNS zone

lling
Node Link

I've created a database for our internal DNS and am trying to pull out everything related to a specific zone. I'm working my way through Graph Academy, but need to have a list sooner than I seem to be able to work it out myself

I have nodes for servers and zones, with the zones having labels Zone, Domain, Forest, and Apex (to somewhat mimic our AD environment). There are five relationship types: IsOn (for zones explicitly configured on a server (meaning server is active and properly configured)), ForwardsTo (with a property of fwdFrom, to link a zone to the server it's configured on), HasNS (links zones with servers that the DNS resolution shows them on (to weed out bad configs where a server no longer exists))., and IsInZone (to show subdomains and servers named within a parent zone.

The graph below shows sort of what I want, but I'm not sure how to get the list of zones that are on the blue server nodes, like in the bottom left corner, or all of the servers from the brown zone nodes in the right corner.
Query: match (n1)-[rel1]-(n2)-[rel2]-(absg:Forest)
where absg.zonename="absg.net"
return n1, rel1,n2, rel2

Thanks!

5 REPLIES 5

It would be helpful for you to describe what "is on" means in your query:

"get the list of zones that are on the blue server nodes"

What relationship are you interested in only the IsOn relationship?

match (n1)-[:IsOn]->(absg:Server)
where absg.zonename="absg.net"
return n1

Elaine

Sorry for the delay in my response - had several personal emergencies come up.

I'm looking for anything that touches anything associated with "absg", whether it be a zone name, a DNS server hosting those domains, a DNS server with an FQDN in one of those domains, or a DNS server forwarding to or from one of those zones.

I've tried the following query, which seems to catch everything, but shows two groupings with no connection between them (this is using GraphXR, which seems to have better performance on my laptop):
optional match path = (n)-[rel]-(n2)
where n.fqdn contains "absg"
or n.zonename contains "absg"
or rel.fwdFrom contains "absg"
return path, n, rel, n2

How do I search all nodes and properties for that keyword and show their relationships?

Are you saying that a property in your relationships is fwdFrom? What are you doing that? It should be sufficient to look for the property containing "absg" in your nodes right?

What do you get when you do the following:

MATCH (n)-[rel]-(n2) WHERE n.fqdn contains "absg" OR n.zonename contains "absg"
RETURN n,rel,n2

Elaine

I still get two separated blogs:

LOL, found the problem... I imported the data twice without validation. Cleaned it up and only have the one I was expecting.