network-direction.asciidoc 3.8 KB

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