Skip to content

Commit

Permalink
FIx failing ip.rst doctest
Browse files Browse the repository at this point in the history
Signed-off-by: currantw <[email protected]>
  • Loading branch information
currantw committed Dec 18, 2024
1 parent b8bf9b8 commit 5298b38
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 21 deletions.
17 changes: 8 additions & 9 deletions docs/user/ppl/functions/ip.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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

18 changes: 6 additions & 12 deletions doctest/test_data/weblogs.json
Original file line number Diff line number Diff line change
@@ -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"}
{"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"}
21 changes: 21 additions & 0 deletions doctest/test_mapping/weblogs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"mappings": {
"properties": {
"host": {
"type": "ip"
},
"method": {
"type": "text"
},
"url": {
"type": "text"
},
"response": {
"type": "text"
},
"bytes": {
"type": "text"
}
}
}
}

0 comments on commit 5298b38

Please sign in to comment.