connectors-network-drive.asciidoc 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533
  1. [#es-connectors-network-drive]
  2. === Elastic network drive connector reference
  3. ++++
  4. <titleabbrev>Network drive</titleabbrev>
  5. ++++
  6. // Attributes used in this file:
  7. :service-name: Network drive
  8. :service-name-stub: network_drive
  9. The _Elastic network drive connector_ is a <<es-connectors,connector>> for network drive data sources.
  10. This connector is written in Python using the {connectors-python}[Elastic connector framework^].
  11. View the {connectors-python}/connectors/sources/{service-name-stub}.py[*source code* for this connector^] (branch _{connectors-branch}_, compatible with Elastic _{minor-version}_).
  12. .Choose your connector reference
  13. *******************************
  14. Are you using a managed connector on Elastic Cloud or a self-managed connector? Expand the documentation based on your deployment method.
  15. *******************************
  16. // //////// //// //// //// //// //// //// ////////
  17. // //////// NATIVE CONNECTOR REFERENCE ///////
  18. // //////// //// //// //// //// //// //// ////////
  19. [discrete#es-connectors-network-drive-native-connector-reference]
  20. ==== *Elastic managed connector reference*
  21. .View *Elastic managed connector* reference
  22. [%collapsible]
  23. ===============
  24. [discrete#es-connectors-network-drive-prerequisites]
  25. ===== Availability and prerequisites
  26. This connector is available as a *managed connector* on Elastic Cloud, as of *8.9.1*.
  27. To use this connector natively in Elastic Cloud, satisfy all <<es-native-connectors-prerequisites,managed connector requirements>>.
  28. [discrete#es-connectors-network-drive-usage]
  29. ===== Usage
  30. To use this connector natively in Elastic Cloud, see <<es-native-connectors>>.
  31. [discrete#es-connectors-network-drive-configuration]
  32. ===== Configuration
  33. The following configuration fields are required to set up the connector:
  34. Username::
  35. The username of the account for the network drive.
  36. The user must have at least **read** permissions for the folder path provided.
  37. Password::
  38. The password of the account to be used for crawling the network drive.
  39. IP address::
  40. The server IP address where the network drive is hosted.
  41. Default value is `127.0.0.1`.
  42. Port::
  43. The server port where the network drive service is available.
  44. Default value is `445`.
  45. Path::
  46. ** The network drive path the connector will crawl to fetch files.
  47. This is the name of the folder shared via SMB.
  48. The connector uses the Python https://github.com/jborean93/smbprotocol[`smbprotocol`^] library which supports both *SMB v2* and *v3*.
  49. ** Accepts only one path— parent folders can be specified to widen the scope.
  50. ** The drive path should use *forward slashes* as path separators.
  51. Example:
  52. +
  53. * `admin/bin`
  54. Enable document level security::
  55. Toggle to enable document level security (DLS). When enabled:
  56. * Full syncs will fetch access control lists for each document and store them in the `_allow_access_control` field.
  57. * Access control syncs will fetch users' access control lists and store them in a separate index.
  58. Default value is `false`.
  59. +
  60. [TIP]
  61. ====
  62. Refer to <<es-connectors-network-drive-dls, Document level security>> for more information, including prerequisites and limitations.
  63. ====
  64. Identity mappings::
  65. Path to a CSV file containing user and group SIDs (For Linux Network Drive).
  66. +
  67. File should be formatted as follows:
  68. +
  69. * Fields separated by semicolons (`;`)
  70. * Three fields per line: `Username;User-SID;Group-SIDs`
  71. * Group-SIDs are comma-separated and optional.
  72. +
  73. *Example* with one username, user-sid and no group:
  74. +
  75. [source,text]
  76. ----
  77. user1;S-1;
  78. ----
  79. +
  80. *Example* with one username, user-sid and two groups:
  81. +
  82. [source,text]
  83. ----
  84. user1;S-1;S-11,S-22
  85. ----
  86. [discrete#es-connectors-network-drive-documents-syncs]
  87. ===== Documents and syncs
  88. The connector syncs folders as separate documents in Elasticsearch.
  89. The following fields will be added for the document type `folder`:
  90. * `create_time`
  91. * `title`
  92. * `path`
  93. * `modified`
  94. * `time`
  95. * `id`
  96. [NOTE]
  97. ====
  98. * Content from files bigger than 10 MB won't be extracted. (Self-managed connectors can use the <<es-connectors-content-extraction-local, self-managed local extraction service>> to handle larger binary files.)
  99. * Permissions are not synced by default.
  100. You must first enable <<es-connectors-network-drive-client-dls,DLS>>.
  101. Otherwise, *all documents* indexed to an Elastic deployment will be visible to *all users with access* to that Elastic Deployment.
  102. ====
  103. [discrete#es-connectors-network-drive-sync-types]
  104. ====== Sync types
  105. <<es-connectors-sync-types-full,Full syncs>> are supported by default for all connectors.
  106. This connector also supports <<es-connectors-sync-types-incremental,incremental syncs>>.
  107. [discrete#es-connectors-network-drive-dls]
  108. ===== Document level security
  109. Document Level Security (DLS) enables you to restrict access to documents based on a user's permissions.
  110. DLS facilitates the syncing of folder and file permissions, including both user and group level permissions.
  111. [NOTE]
  112. ====
  113. **Note:** Refer to <<es-dls-e2e-guide,DLS in Search Applications>> to learn how to search data with DLS enabled, when building a search application.
  114. ====
  115. [discrete#es-connectors-network-drive-dls-availability]
  116. ====== Availability
  117. * The present version of Network Drive connector offers DLS support for Windows network drives only.
  118. * To fetch users and groups in a Windows network drive, account credentials added in the connector configuration should have access to the Powershell of the Windows Server where the network drive is hosted.
  119. [discrete#es-connectors-network-drive-sync-rules]
  120. ===== Sync rules
  121. <<es-sync-rules-basic,Basic sync rules>> are identical for all connectors and are available by default.
  122. [discrete#es-connectors-network-drive-sync-rules-advanced]
  123. ====== Advanced sync rules
  124. [NOTE]
  125. ====
  126. A <<es-connectors-sync-types-full, full sync>> is required for advanced sync rules to take effect.
  127. ====
  128. Advanced sync rules are defined through a source-specific DSL JSON snippet.
  129. Advanced sync rules for this connector use *glob patterns*.
  130. 1. Each rule must contains a glob pattern. This pattern is then matched against all the available folder paths inside the configured drive path.
  131. 2. The pattern must begin with the `drive_path` field configured in the connector.
  132. 3. If the pattern matches any available folder paths, the contents directly within those folders will be fetched.
  133. The following sections provide examples of advanced sync rules for this connector.
  134. [discrete#es-connectors-network-drive-indexing-files-and-folders-recursively-within-folders]
  135. *Indexing files and folders recursively within folders*
  136. [source,js]
  137. ----
  138. [
  139. {
  140. "pattern": "Folder-shared/a/mock/**"
  141. },
  142. {
  143. "pattern": "Folder-shared/b/alpha/**"
  144. }
  145. ]
  146. ----
  147. // NOTCONSOLE
  148. [discrete#es-connectors-network-drive-indexing-files-and-folders-directly-inside-folder]
  149. *Indexing files and folders directly inside folder*
  150. [source,js]
  151. ----
  152. [
  153. {
  154. "pattern": "Folder-shared/a/b/test"
  155. }
  156. ]
  157. ----
  158. // NOTCONSOLE
  159. [discrete#es-connectors-network-drive-indexing-files-and-folders-directly-inside-a-set-of-folders]
  160. *Indexing files and folders directly inside a set of folders*
  161. [source,js]
  162. ----
  163. [
  164. {
  165. "pattern": "Folder-shared/org/*/all-tests/test[135]"
  166. }
  167. ]
  168. ----
  169. // NOTCONSOLE
  170. [discrete#es-connectors-network-drive-excluding-files-and-folders-that-match-a-pattern]
  171. *Excluding files and folders that match a pattern*
  172. [source,js]
  173. ----
  174. [
  175. {
  176. "pattern": "Folder-shared/**/all-tests/test[!7]"
  177. }
  178. ]
  179. ----
  180. // NOTCONSOLE
  181. [discrete#es-connectors-network-drive-content-extraction]
  182. ===== Content extraction
  183. See <<es-connectors-content-extraction>>.
  184. [discrete#es-connectors-network-drive-known-issues]
  185. ===== Known issues
  186. There are no known issues for this connector.
  187. See <<es-connectors-known-issues>> for any issues affecting all connectors.
  188. [discrete#es-connectors-network-drive-troubleshooting]
  189. ===== Troubleshooting
  190. See <<es-connectors-troubleshooting>>.
  191. [discrete#es-connectors-network-drive-security]
  192. ===== Security
  193. See <<es-connectors-security>>.
  194. // Closing the collapsible section
  195. ===============
  196. // //////// //// //// //// //// //// //// ////////
  197. // //////// CONNECTOR CLIENT REFERENCE ///////
  198. // //////// //// //// //// //// //// //// ////////
  199. [discrete#es-connectors-network-drive-connector-client-reference]
  200. ==== *Self-managed connector*
  201. .View *self-managed connector* reference
  202. [%collapsible]
  203. ===============
  204. [discrete#es-connectors-network-drive-client-prerequisites]
  205. ===== Availability and prerequisites
  206. This connector is available as a self-managed *self-managed connector*.
  207. This self-managed connector is compatible with Elastic versions *8.6.0+*.
  208. To use this connector, satisfy all <<es-build-connector,self-managed connector requirements>>.
  209. [discrete#es-connectors-network-drive-client-usage]
  210. ===== Usage
  211. To use this connector as a *self-managed connector*, see <<es-build-connector>>For additional usage operations, see <<es-connectors-usage>>.
  212. [discrete#es-connectors-network-drive-client-configuration]
  213. ===== Configuration
  214. [TIP]
  215. ====
  216. When using the <<es-build-connector, self-managed connector>> workflow, initially these fields will use the default configuration set in the {connectors-python}/connectors/sources/network_drive.py[connector source code^].
  217. These are set in the `get_default_configuration` function definition.
  218. These configurable fields will be rendered with their respective *labels* in the Kibana UI.
  219. Once connected, you'll be able to update these values in Kibana.
  220. ====
  221. The following configuration fields are required to set up the connector:
  222. `username`::
  223. The username of the account for the network drive.
  224. The user must have at least **read** permissions for the folder path provided.
  225. `password`::
  226. The password of the account to be used for crawling the network drive.
  227. `server_ip`::
  228. The server IP address where the network drive is hosted.
  229. Default value is `127.0.0.1`.
  230. `server_port`::
  231. The server port where the network drive service is available.
  232. Default value is `445`.
  233. `drive_path`::
  234. ** The network drive path the connector will crawl to fetch files.
  235. This is the name of the folder shared via SMB.
  236. The connector uses the Python https://github.com/jborean93/smbprotocol[`smbprotocol`^] library which supports both *SMB v2* and *v3*.
  237. ** Accepts only one path— parent folders can be specified to widen the scope.
  238. ** The drive path should use *forward slashes* as path separators.
  239. Example:
  240. +
  241. * `admin/bin`
  242. `use_document_level_security`::
  243. Toggle to enable document level security (DLS). When enabled:
  244. * Full syncs will fetch access control lists for each document and store them in the `_allow_access_control` field.
  245. * Access control syncs will fetch users' access control lists and store them in a separate index.
  246. +
  247. [TIP]
  248. ====
  249. Refer to <<es-connectors-network-drive-client-dls, Document level security>> for more information, including prerequisites and limitations.
  250. ====
  251. `drive_type`::
  252. The type of network drive to be crawled.
  253. The following options are available:
  254. +
  255. * `Windows`
  256. * `Linux`
  257. `identity_mappings`::
  258. Path to a CSV file containing user and group SIDs (For Linux Network Drive).
  259. +
  260. File should be formatted as follows:
  261. +
  262. * Fields separated by semicolons (`;`)
  263. * Three fields per line: `Username;User-SID;Group-SIDs`
  264. * Group-SIDs are comma-separated and optional.
  265. +
  266. *Example* with one username, user-sid and no group:
  267. +
  268. [source,text]
  269. ----
  270. user1;S-1;
  271. ----
  272. +
  273. *Example* with one username, user-sid and two groups:
  274. +
  275. [source,text]
  276. ----
  277. user1;S-1;S-11,S-22
  278. ----
  279. [discrete#es-connectors-network-drive-client-docker]
  280. ===== Deployment using Docker
  281. include::_connectors-docker-instructions.asciidoc[]
  282. [discrete#es-connectors-network-drive-client-documents-syncs]
  283. ===== Documents and syncs
  284. The connector syncs folders as separate documents in Elasticsearch.
  285. The following fields will be added for the document type `folder`:
  286. * `create_time`
  287. * `title`
  288. * `path`
  289. * `modified`
  290. * `time`
  291. * `id`
  292. [NOTE]
  293. ====
  294. * Content from files bigger than 10 MB won't be extracted
  295. * Permissions are not synced by default.
  296. You must first enable <<es-connectors-network-drive-client-dls,DLS>>.
  297. Otherwise, *all documents* indexed to an Elastic deployment will be visible to *all users with access* to that Elastic Deployment.
  298. ====
  299. [discrete#es-connectors-network-drive-client-sync-types]
  300. ====== Sync types
  301. <<es-connectors-sync-types-full,Full syncs>> are supported by default for all connectors.
  302. This connector also supports <<es-connectors-sync-types-incremental,incremental syncs>>.
  303. [discrete#es-connectors-network-drive-client-dls]
  304. ===== Document level security
  305. Document Level Security (DLS) enables you to restrict access to documents based on a user's permissions.
  306. DLS facilitates the syncing of folder and file permissions, including both user and group level permissions.
  307. [NOTE]
  308. ====
  309. **Note:** Refer to <<es-dls-e2e-guide,DLS in Search Applications>> to learn how to search data with DLS enabled, when building a search application.
  310. ====
  311. [discrete#es-connectors-network-drive-client-dls-availability]
  312. ====== Availability
  313. * The Network Drive self-managed connector offers DLS support for both Windows and Linux network drives.
  314. * To fetch users and groups in a Windows network drive, account credentials added in the connector configuration should have access to the Powershell of the Windows Server where the network drive is hosted.
  315. [discrete#es-connectors-network-drive-client-sync-rules]
  316. ===== Sync rules
  317. <<es-sync-rules-basic,Basic sync rules>> are identical for all connectors and are available by default.
  318. [discrete#es-connectors-network-drive-client-sync-rules-advanced]
  319. ====== Advanced sync rules
  320. [NOTE]
  321. ====
  322. A <<es-connectors-sync-types-full, full sync>> is required for advanced sync rules to take effect.
  323. ====
  324. Advanced sync rules are defined through a source-specific DSL JSON snippet.
  325. Advanced sync rules for this connector use *glob patterns*.
  326. 1. Each rule must contains a glob pattern. This pattern is then matched against all the available folder paths inside the configured drive path.
  327. 2. The pattern must begin with the `drive_path` field configured in the connector.
  328. 3. If the pattern matches any available folder paths, the contents directly within those folders will be fetched.
  329. The following sections provide examples of advanced sync rules for this connector.
  330. [discrete#es-connectors-network-drive-client-indexing-files-and-folders-recursively-within-folders]
  331. *Indexing files and folders recursively within folders*
  332. [source,js]
  333. ----
  334. [
  335. {
  336. "pattern": "Folder-shared/a/mock/**"
  337. },
  338. {
  339. "pattern": "Folder-shared/b/alpha/**"
  340. }
  341. ]
  342. ----
  343. // NOTCONSOLE
  344. [discrete#es-connectors-network-drive-client-indexing-files-and-folders-directly-inside-folder]
  345. *Indexing files and folders directly inside folder*
  346. [source,js]
  347. ----
  348. [
  349. {
  350. "pattern": "Folder-shared/a/b/test"
  351. }
  352. ]
  353. ----
  354. // NOTCONSOLE
  355. [discrete#es-connectors-network-drive-client-indexing-files-and-folders-directly-inside-a-set-of-folders]
  356. *Indexing files and folders directly inside a set of folders*
  357. [source,js]
  358. ----
  359. [
  360. {
  361. "pattern": "Folder-shared/org/*/all-tests/test[135]"
  362. }
  363. ]
  364. ----
  365. // NOTCONSOLE
  366. [discrete#es-connectors-network-drive-client-excluding-files-and-folders-that-match-a-pattern]
  367. *Excluding files and folders that match a pattern*
  368. [source,js]
  369. ----
  370. [
  371. {
  372. "pattern": "Folder-shared/**/all-tests/test[!7]"
  373. }
  374. ]
  375. ----
  376. // NOTCONSOLE
  377. [discrete#es-connectors-network-drive-client-content-extraction]
  378. ===== Content extraction
  379. See <<es-connectors-content-extraction>>.
  380. [discrete#es-connectors-network-drive-client-tests]
  381. ===== End-to-end tests
  382. The connector framework enables operators to run functional tests against a real data source.
  383. Refer to <<es-build-connector-testing>> for more details.
  384. To execute a functional test for the Network Drive self-managed connector, run the following command:
  385. [source,shell]
  386. ----
  387. $ make ftest NAME=network_drive
  388. ----
  389. By default, this will use a medium-sized dataset.
  390. For faster tests add the `DATA_SIZE=small` flag:
  391. [source,shell]
  392. ----
  393. make ftest NAME=network_drive DATA_SIZE=small
  394. ----
  395. [discrete#es-connectors-network-drive-client-known-issues]
  396. ===== Known issues
  397. There are no known issues for this connector.
  398. See <<es-connectors-known-issues>> for any issues affecting all connectors.
  399. [discrete#es-connectors-network-drive-client-troubleshooting]
  400. ===== Troubleshooting
  401. See <<es-connectors-troubleshooting>>.
  402. [discrete#es-connectors-network-drive-client-security]
  403. ===== Security
  404. See <<es-connectors-security>>.
  405. // Closing the collapsible section
  406. ===============