network-direction.asciidoc 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. These may be constructed with <<template-snippets,template snippets>>. * Must specify only one of `internal_networks` or `internal_networks_field`.
  23. | `internal_networks_field`| no | | A field on the given document to read the `internal_networks` configuration from.
  24. | `ignore_missing` | no | `true` | If `true` and any required fields are missing,
  25. the processor quietly exits without modifying the document.
  26. include::common-options.asciidoc[]
  27. |======
  28. One of either `internal_networks` or `internal_networks_field` must be specified. If `internal_networks_field` is specified, it follows the behavior specified by `ignore_missing`.
  29. [float]
  30. [[supported-named-network-ranges]]
  31. ===== Supported named network ranges
  32. The named ranges supported for the `internal_networks` option are:
  33. - `loopback` - Matches loopback addresses in the range of `127.0.0.0/8` or
  34. `::1/128`.
  35. - `unicast` or `global_unicast` - Matches global unicast addresses defined in
  36. RFC 1122, RFC 4632, and RFC 4291 with the exception of the IPv4 broadcast
  37. address (`255.255.255.255`). This includes private address ranges.
  38. - `multicast` - Matches multicast addresses.
  39. - `interface_local_multicast` - Matches IPv6 interface-local multicast addresses.
  40. - `link_local_unicast` - Matches link-local unicast addresses.
  41. - `link_local_multicast` - Matches link-local multicast addresses.
  42. - `private` - Matches private address ranges defined in RFC 1918 (IPv4) and
  43. RFC 4193 (IPv6).
  44. - `public` - Matches addresses that are not loopback, unspecified, IPv4
  45. broadcast, link local unicast, link local multicast, interface local
  46. multicast, or private.
  47. - `unspecified` - Matches unspecified addresses (either the IPv4 address
  48. "0.0.0.0" or the IPv6 address "::").
  49. [discrete]
  50. [[network-direction-processor-ex]]
  51. ===== Examples
  52. The following example illustrates the use of the network direction processor:
  53. [source,console]
  54. ----
  55. POST _ingest/pipeline/_simulate
  56. {
  57. "pipeline": {
  58. "processors": [
  59. {
  60. "network_direction": {
  61. "internal_networks": ["private"]
  62. }
  63. }
  64. ]
  65. },
  66. "docs": [
  67. {
  68. "_source": {
  69. "source": {
  70. "ip": "128.232.110.120"
  71. },
  72. "destination": {
  73. "ip": "192.168.1.1"
  74. }
  75. }
  76. }
  77. ]
  78. }
  79. ----
  80. Which produces the following result:
  81. [source,console-result]
  82. ----
  83. {
  84. "docs": [
  85. {
  86. "doc": {
  87. ...
  88. "_source": {
  89. "destination": {
  90. "ip": "192.168.1.1"
  91. },
  92. "source": {
  93. "ip": "128.232.110.120"
  94. },
  95. "network": {
  96. "direction": "inbound"
  97. }
  98. }
  99. }
  100. }
  101. ]
  102. }
  103. ----
  104. // TESTRESPONSE[s/\.\.\./"_index":"_index","_id":"_id","_ingest":{"timestamp":$body.docs.0.doc._ingest.timestamp},/]
  105. // NOTCONSOLE