network-direction.asciidoc 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. [role="xpack"]
  2. [testenv="basic"]
  3. [[network-direction-processor]]
  4. === Network direction processor
  5. ++++
  6. <titleabbrev>Network Direction</titleabbrev>
  7. ++++
  8. Calculates the network direction given a source IP address, destination IP
  9. address, and a list of internal networks.
  10. The network direction processor reads IP addresses from
  11. {ecs-ref}[Elastic Common Schema (ECS)] fields by default. If you use the ECS,
  12. only the `internal_networks` option must be specified.
  13. [[network-direction-options]]
  14. .Network Direction Options
  15. [options="header"]
  16. |======
  17. | Name | Required | Default | Description
  18. | `source_ip` | no | `source.ip` | Field containing the source IP address.
  19. | `destination_ip` | no | `destination.ip` | Field containing the destination IP address.
  20. | `target_field` | no | `network.direction` | Output field for the network direction.
  21. | `internal_networks`| yes | | List of internal networks. Supports IPv4 and
  22. IPv6 addresses and ranges in CIDR notation. Also supports the named ranges listed below.
  23. | `ignore_missing` | no | `true` | If `true` and any required fields are missing,
  24. the processor quietly exits without modifying the document.
  25. include::common-options.asciidoc[]
  26. |======
  27. [float]
  28. [[supported-named-network-ranges]]
  29. ===== Supported named network ranges
  30. The named ranges supported for the `internal_networks` option are:
  31. - `loopback` - Matches loopback addresses in the range of `127.0.0.0/8` or
  32. `::1/128`.
  33. - `unicast` or `global_unicast` - Matches global unicast addresses defined in
  34. RFC 1122, RFC 4632, and RFC 4291 with the exception of the IPv4 broadcast
  35. address (`255.255.255.255`). This includes private address ranges.
  36. - `multicast` - Matches multicast addresses.
  37. - `interface_local_multicast` - Matches IPv6 interface-local multicast addresses.
  38. - `link_local_unicast` - Matches link-local unicast addresses.
  39. - `link_local_multicast` - Matches link-local multicast addresses.
  40. - `private` - Matches private address ranges defined in RFC 1918 (IPv4) and
  41. RFC 4193 (IPv6).
  42. - `public` - Matches addresses that are not loopback, unspecified, IPv4
  43. broadcast, link local unicast, link local multicast, interface local
  44. multicast, or private.
  45. - `unspecified` - Matches unspecified addresses (either the IPv4 address
  46. "0.0.0.0" or the IPv6 address "::").
  47. [discrete]
  48. [[network-direction-processor-ex]]
  49. ===== Examples
  50. The following example illustrates the use of the network direction processor:
  51. [source,console]
  52. ----
  53. POST _ingest/pipeline/_simulate
  54. {
  55. "pipeline": {
  56. "processors": [
  57. {
  58. "network_direction": {
  59. "internal_networks": ["private"]
  60. }
  61. }
  62. ]
  63. },
  64. "docs": [
  65. {
  66. "_source": {
  67. "source": {
  68. "ip": "128.232.110.120"
  69. },
  70. "destination": {
  71. "ip": "192.168.1.1"
  72. }
  73. }
  74. }
  75. ]
  76. }
  77. ----
  78. Which produces the following result:
  79. [source,console-result]
  80. ----
  81. {
  82. "docs": [
  83. {
  84. "doc": {
  85. ...
  86. "_source": {
  87. "destination": {
  88. "ip": "192.168.1.1"
  89. },
  90. "source": {
  91. "ip": "128.232.110.120"
  92. },
  93. "network": {
  94. "direction": "inbound"
  95. }
  96. }
  97. }
  98. }
  99. ]
  100. }
  101. ----
  102. // TESTRESPONSE[s/\.\.\./"_index":"_index","_id":"_id","_ingest":{"timestamp":$body.docs.0.doc._ingest.timestamp},/]
  103. // NOTCONSOLE