diff --git a/docs/user/ppl/functions/ip.rst b/docs/user/ppl/functions/ip.rst index 429713dded..30cb9020b0 100644 --- a/docs/user/ppl/functions/ip.rst +++ b/docs/user/ppl/functions/ip.rst @@ -20,20 +20,19 @@ Argument type: STRING, STRING Return type: BOOLEAN -Example: +Example:: - os> source=weblogs | where cidrmatch(host, '1.2.3.0/24') | fields host, url + > source=weblogs | where cidrmatch(host, '1.2.3.0/24') | fields host, url fetched rows / total rows = 2/2 - +---------+--------------------| - | host | url | +---------+--------------------+ + | host | url | + |---------|--------------------| | 1.2.3.4 | /history/voyager1/ | | 1.2.3.5 | /history/voyager2/ | - +---------+--------------------| + +---------+--------------------+ Note: - - `ip` can be an IPv4 or an IPv6 address - - `cidr` can be an IPv4 or an IPv6 block - - `ip` and `cidr` must be either both IPv4 or both IPv6 - - `ip` and `cidr` must both be valid and non-empty/non-null + - `ip` can be an IPv4 or IPv6 address + - `cidr` can be an IPv4 or IPv6 block + - `ip` and `cidr` must both be valid and non-missing/non-null diff --git a/doctest/test_data/weblogs.json b/doctest/test_data/weblogs.json index fbfc8d417b..afb1679e22 100644 --- a/doctest/test_data/weblogs.json +++ b/doctest/test_data/weblogs.json @@ -1,12 +1,6 @@ -{"index":{}} -{"host": "::1", "method": "GET", "url": "/history/apollo/", "response": "200", "bytes": "6245"} -{"index":{}} -{"host": "0.0.0.2", "method": "GET", "url": "/shuttle/missions/sts-73/mission-sts-73.html", "response": "200", "bytes": "4085"} -{"index":{}} -{"host": "::3", "method": "GET", "url": "/shuttle/countdown/countdown.html", "response": "200", "bytes": "3985"} -{"index":{}} -{"host": "::FFFF:1.2.3.4", "method": "GET", "url": "/history/voyager1/", "response": "200", "bytes": "1234"} -{"index":{}} -{"host": "1.2.3.5", "method": "GET", "url": "/history/voyager2/", "response": "200", "bytes": "4321"} -{"index":{}} -{"host": "::FFFF:1234", "method": "GET", "url": "/history/artemis/", "response": "200", "bytes": "9876"} \ No newline at end of file +{"host":"::1","method":"GET","url":"/history/apollo/","response":"200","bytes":"6245"} +{"host":"0.0.0.2","method":"GET","url":"/shuttle/missions/sts-73/mission-sts-73.html","response":"200","bytes":"4085"} +{"host":"::3","method":"GET","url":"/shuttle/countdown/countdown.html","response":"200","bytes":"3985"} +{"host":"::FFFF:1.2.3.4","method":"GET","url":"/history/voyager1/","response":"200","bytes":"1234"} +{"host":"1.2.3.5","method":"GET","url":"/history/voyager2/","response": "200","bytes":"4321"} +{"host":"::FFFF:1234","method":"GET","url":"/history/artemis/","response":"200","bytes": "9876"} diff --git a/doctest/test_mapping/weblogs.json b/doctest/test_mapping/weblogs.json new file mode 100644 index 0000000000..05b9784313 --- /dev/null +++ b/doctest/test_mapping/weblogs.json @@ -0,0 +1,21 @@ +{ + "mappings": { + "properties": { + "host": { + "type": "ip" + }, + "method": { + "type": "text" + }, + "url": { + "type": "text" + }, + "response": { + "type": "text" + }, + "bytes": { + "type": "text" + } + } + } +}