connectors-dropbox.asciidoc 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580
  1. [#es-connectors-dropbox]
  2. === Elastic Dropbox connector reference
  3. ++++
  4. <titleabbrev>Dropbox</titleabbrev>
  5. ++++
  6. // Attributes used in this file
  7. :service-name: Dropbox
  8. :service-name-stub: dropbox
  9. The _Elastic Dropbox connector_ is a <<es-connectors,connector>> for https://www.dropbox.com[Dropbox^].
  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-dropbox-native-connector-reference]
  20. ==== *Elastic managed connector reference*
  21. .View *Elastic managed connector* reference
  22. [%collapsible]
  23. ===============
  24. [discrete#es-connectors-dropbox-availability-and-prerequisites]
  25. ===== Availability and prerequisites
  26. This connector is available as a *managed connector* in Elastic versions *8.10.0 and later*.
  27. To use this connector natively in Elastic Cloud, satisfy all <<es-native-connectors-prerequisites,managed connector requirements>>.
  28. [discrete#es-connectors-dropbox-create-native-connector]
  29. ===== Create a {service-name} connector
  30. include::_connectors-create-native.asciidoc[]
  31. [discrete#es-connectors-dropbox-usage]
  32. ===== Usage
  33. To use this connector as a *managed connector*, see <<es-native-connectors>>.
  34. For additional operations, see <<es-connectors-usage>>.
  35. Before you can configure your connector, you'll need to:
  36. * <<es-connectors-dropbox-create-dropbox-oauth-app,Create a Dropbox OAuth app>>
  37. * <<es-connectors-dropbox-refresh-token,Generate a refresh token>>
  38. [discrete#es-connectors-dropbox-dropbox-api-authorization]
  39. ===== Dropbox API Authorization
  40. [discrete#es-connectors-dropbox-create-dropbox-oauth-app]
  41. ====== Create Dropbox OAuth App
  42. You'll need to create an OAuth app in the Dropbox platform by following these steps:
  43. 1. Register a new app in the https://www.dropbox.com/developers/apps[Dropbox App Console^].
  44. Select *Full Dropbox API app* and choose the following required permissions:
  45. * `files.content.read`
  46. * `sharing.read`
  47. +
  48. To use document level security, you'll also need the following permissions:
  49. * `team_info.read`
  50. * `team_data.member`
  51. * `team_data.content.read`
  52. * `members.read`
  53. 2. Once the app is created, make note of the *app key* and *app secret* values which you'll need to configure the Dropbox connector on your Elastic deployment.
  54. [discrete#es-connectors-dropbox-refresh-token]
  55. ====== Generate a refresh Token
  56. To generate a refresh token, follow these steps:
  57. 1. Go to the following URL, replacing `<APP_KEY>` with the *app key* value saved earlier:
  58. `https://www.dropbox.com/oauth2/authorize?client_id=<APP_KEY>&response_type=code&token_access_type=offline`
  59. +
  60. The HTTP response should contain an *authorization code* that you'll use to generate a refresh token.
  61. An authorization code *can only be used once* to create a refresh token.
  62. +
  63. 2. In your terminal, run the following `cURL` command, replacing `<AUTHORIZATION_CODE>`, `<APP_KEY>:<APP_SECRET>` with the values you saved earlier:
  64. +
  65. [source,shell]
  66. ----
  67. curl -X POST "https://api.dropboxapi.com/oauth2/token?code=<AUTHORIZATION_CODE>&grant_type=authorization_code" -u "<APP_KEY>:<APP_SECRET>"
  68. ----
  69. // NOTCONSOLE
  70. Store the refresh token from the response to be used in the connector configuration.
  71. +
  72. Make sure the response has a list of the following scopes:
  73. +
  74. * `account_info.read`
  75. * `files.content.read`
  76. * `files.metadata.read`
  77. * `sharing.read`
  78. * `team_info.read` (if using document level security)
  79. * `team_data.member` (if using document level security)
  80. * `team_data.content.read` (if using document level security)
  81. * `members.read` (if using document level security)
  82. [discrete#es-connectors-dropbox-configuration]
  83. ===== Configuration
  84. The following configuration fields are required to set up the connector:
  85. Path to fetch files/folders::
  86. The folder path to fetch files/folders from Dropbox. Default value is `/`.
  87. +
  88. [Note]
  89. ====
  90. This field can be bypassed by advanced sync rules.
  91. ====
  92. App key::
  93. The App Key to authenticate your Dropbox application.
  94. App secret::
  95. The App Secret to authenticate your Dropbox application.
  96. Refresh token::
  97. The refresh token to authenticate your Dropbox application.
  98. Enable document level security::
  99. Toggle to enable <<es-dls, document level security (DLS)>>.
  100. When enabled, full syncs will fetch access control lists for each document and store them in the `_allow_access_control` field.
  101. Access control syncs will fetch users' access control lists and store them in a separate index.
  102. Include groups and inherited users::
  103. Appears when document level security is enabled.
  104. Include groups and inherited users when indexing permissions.
  105. [WARNING]
  106. ====
  107. Enabling `Include groups and inherited users` will cause a signficant performance degradation.
  108. ====
  109. [discrete#es-connectors-dropbox-documents-and-syncs]
  110. ===== Documents and syncs
  111. The connector syncs the following objects and entities:
  112. * *Files*
  113. ** Includes metadata such as file name, path, size, content, etc.
  114. * *Folders*
  115. [NOTE]
  116. ====
  117. Due to a Dropbox issue, metadata updates to Paper files from Dropbox Paper are not immediately reflected in the Dropbox UI.
  118. This delays the availability of updated results for the connector.
  119. Once the metadata changes are visible in the Dropbox UI, the updates are available.
  120. ====
  121. [NOTE]
  122. ====
  123. * 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.)
  124. * Currently, the connector doesn't retrieve files from shared Team folders.
  125. * Permissions are not synced by default. If <<es-dls, document level security (DLS)>> is not enabled *all documents* indexed to an Elastic deployment will be visible to *all users with access* to that Elastic Deployment.
  126. ====
  127. [discrete#es-connectors-dropbox-sync-types]
  128. ====== Sync types
  129. <<es-connectors-sync-types-full,Full syncs>> are supported by default for all connectors.
  130. This connector also supports <<es-connectors-sync-types-incremental,incremental syncs>>.
  131. [discrete#es-connectors-dropbox-sync-rules]
  132. ===== Sync rules
  133. <<es-sync-rules-basic, Basic sync rules>> are identical for all connectors and are available by default.
  134. [discrete#es-connectors-dropbox-sync-rules-advanced]
  135. ====== Advanced sync rules
  136. [NOTE]
  137. ====
  138. A <<es-connectors-sync-types-full, full sync>> is required for advanced sync rules to take effect.
  139. ====
  140. The following section describes <<es-sync-rules-advanced,advanced sync rules>> for this connector.
  141. Advanced sync rules for Dropbox allow you to sync Dropbox files based on a query that matches strings in the filename.
  142. You can optionally filter the results of the query by `file_extensions` or `file_categories`.
  143. When both are provided, priority is given to `file_categories`.
  144. We have some examples below for illustration.
  145. [discrete#es-connectors-dropbox-sync-rules-advanced-example-1]
  146. *Example: Query only*
  147. [source,js]
  148. ----
  149. [
  150. {
  151. "query": "confidential"
  152. },
  153. {
  154. "query": "dropbox"
  155. }
  156. ]
  157. ----
  158. // NOTCONSOLE
  159. [discrete#es-connectors-dropbox-sync-rules-advanced-example-2]
  160. *Example: Query with file extension filter*
  161. [source,js]
  162. ----
  163. [
  164. {
  165. "query": "dropbox",
  166. "options": {
  167. "file_extensions": [
  168. "txt",
  169. "pdf"
  170. ]
  171. }
  172. }
  173. ]
  174. ----
  175. // NOTCONSOLE
  176. [discrete#es-connectors-dropbox-sync-rules-advanced-example-3]
  177. *Example: Query with file category filter*
  178. [source,js]
  179. ----
  180. [
  181. {
  182. "query": "test",
  183. "options": {
  184. "file_categories": [
  185. {
  186. ".tag": "paper"
  187. },
  188. {
  189. ".tag": "png"
  190. }
  191. ]
  192. }
  193. }
  194. ]
  195. ----
  196. // NOTCONSOLE
  197. [discrete#es-connectors-dropbox-sync-rules-advanced-limitations]
  198. *Limitations*
  199. * Content extraction is not supported for Dropbox *Paper* files when advanced sync rules are enabled.
  200. [discrete#es-connectors-dropbox-known-issues]
  201. ===== Known issues
  202. Refer to <<es-connectors-known-issues>> for a list of known issues for all connectors.
  203. [discrete#es-connectors-dropbox-troubleshooting]
  204. ===== Troubleshooting
  205. See <<es-connectors-troubleshooting>> for a list of troubleshooting tips for all connectors.
  206. [discrete#es-connectors-dropbox-security]
  207. ===== Security
  208. See <<es-connectors-security>> for a list of security tips for all connectors.
  209. [discrete#es-connectors-dropbox-content-extraction]
  210. ===== Content extraction
  211. See <<es-connectors-content-extraction>>.
  212. // Closing the collapsible section
  213. ===============
  214. // //////// //// //// //// //// //// //// ////////
  215. // //////// CONNECTOR CLIENT REFERENCE ///////
  216. // //////// //// //// //// //// //// //// ////////
  217. [discrete#es-connectors-dropbox-connector-client-reference]
  218. ==== *Self-managed connector*
  219. .View *self-managed connector* reference
  220. [%collapsible]
  221. ===============
  222. [discrete#es-connectors-dropbox-client-availability-and-prerequisites]
  223. ===== Availability and prerequisites
  224. This connector is available as a self-managed *self-managed connector*.
  225. This self-managed connector is compatible with Elastic versions *8.9.0*+.
  226. To use this connector, satisfy all <<es-build-connector-prerequisites,self-managed connector requirements>>.
  227. [discrete#es-connectors-dropbox-create-connector-client]
  228. ===== Create a {service-name} connector
  229. include::_connectors-create-client.asciidoc[]
  230. [discrete#es-connectors-dropbox-client-usage]
  231. ===== Usage
  232. Before you can configure your connector, you'll need to:
  233. * <<es-connectors-dropbox-client-create-dropbox-oauth-app,Create a Dropbox OAuth app>>
  234. * <<es-connectors-dropbox-client-refresh-token,Generate a refresh token>>
  235. To use this connector as a *self-managed connector*, see <<es-build-connector>>
  236. Once set up, for additional usage operations, see <<es-connectors-usage>>.
  237. [discrete#es-connectors-dropbox-client-dropbox-api-authorization]
  238. ===== Dropbox API Authorization
  239. [discrete#es-connectors-dropbox-client-create-dropbox-oauth-app]
  240. ====== Create Dropbox OAuth App
  241. You'll need to create an OAuth app in the Dropbox platform by following these steps:
  242. 1. Register a new app in the https://www.dropbox.com/developers/apps[Dropbox App Console^].
  243. Select *Full Dropbox API app* and choose the following required permissions:
  244. * `files.content.read`
  245. * `sharing.read`
  246. +
  247. To use document level security, you'll also need the following permissions:
  248. * `team_info.read`
  249. * `team_data.member`
  250. * `team_data.content.read`
  251. * `members.read`
  252. 2. Once the app is created, make note of the *app key* and *app secret* values which you'll need to configure the Dropbox connector on your Elastic deployment.
  253. [discrete#es-connectors-dropbox-client-refresh-token]
  254. ====== Generate a refresh Token
  255. To generate a refresh token, follow these steps:
  256. 1. Go to the following URL, replacing `<APP_KEY>` with the *app key* value saved earlier:
  257. `https://www.dropbox.com/oauth2/authorize?client_id=<APP_KEY>&response_type=code&token_access_type=offline`
  258. +
  259. The HTTP response should contain an *authorization code* that you'll use to generate a refresh token.
  260. An authorization code *can only be used once* to create a refresh token.
  261. +
  262. 2. In your terminal, run the following `cURL` command, replacing `<AUTHORIZATION_CODE>`, `<APP_KEY>:<APP_SECRET>` with the values you saved earlier:
  263. +
  264. [source,shell]
  265. ----
  266. curl -X POST "https://api.dropboxapi.com/oauth2/token?code=<AUTHORIZATION_CODE>&grant_type=authorization_code" -u "<APP_KEY>:<APP_SECRET>"
  267. ----
  268. // NOTCONSOLE
  269. Store the refresh token from the response to be used in the connector configuration.
  270. +
  271. Make sure the response has a list of the following scopes:
  272. +
  273. * `account_info.read`
  274. * `files.content.read`
  275. * `files.metadata.read`
  276. * `sharing.read`
  277. * `team_info.read` (if using document level security)
  278. * `team_data.member` (if using document level security)
  279. * `team_data.content.read` (if using document level security)
  280. * `members.read` (if using document level security)
  281. [discrete#es-connectors-dropbox-client-configuration]
  282. ===== Configuration
  283. [TIP]
  284. ====
  285. 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/confluence.py[connector source code^].
  286. These are set in the `get_default_configuration` function definition.
  287. These configurable fields will be rendered with their respective *labels* in the Kibana UI.
  288. Once connected, you'll be able to update these values in Kibana.
  289. ====
  290. The following configuration fields are required to set up the connector:
  291. `path`::
  292. The folder path to fetch files/folders from Dropbox. Default value is `/`.
  293. `app_key` (required)::
  294. The App Key to authenticate your Dropbox application.
  295. `app_secret` (required)::
  296. The App Secret to authenticate your Dropbox application.
  297. `refresh_token` (required)::
  298. The refresh token to authenticate your Dropbox application.
  299. use_document_level_security::
  300. Toggle to enable <<es-dls, document level security (DLS)>>.
  301. When enabled, full syncs will fetch access control lists for each document and store them in the `_allow_access_control` field.
  302. Access control syncs will fetch users' access control lists and store them in a separate index.
  303. `retry_count`::
  304. The number of retry attempts after a failed request to Dropbox. Default value is `3`.
  305. `concurrent_downloads`::
  306. The number of concurrent downloads for fetching attachment content.
  307. This can help speed up content extraction of attachments. Defaults to `100`.
  308. `use_text_extraction_service`::
  309. Requires a separate deployment of the <<es-connectors-content-extraction-local,Elastic Text Extraction Service>>.
  310. Requires that pipeline settings disable text extraction.
  311. Default value is `False`.
  312. `use_document_level_security`::
  313. Toggle to enable <<es-dls, document level security (DLS)>>.
  314. When enabled, full syncs will fetch access control lists for each document and store them in the `_allow_access_control` field. Access control syncs will fetch users' access control lists and store them in a separate index.
  315. `include_inherited_users_and_groups`::
  316. Depends on document level security being enabled.
  317. Include groups and inherited users when indexing permissions.
  318. [WARNING]
  319. ====
  320. Enabling `Include groups and inherited users` will cause a signficant performance degradation.
  321. ====
  322. [discrete#es-connectors-dropbox-client-docker]
  323. ===== Deployment using Docker
  324. include::_connectors-docker-instructions.asciidoc[]
  325. [discrete#es-connectors-dropbox-client-documents-and-syncs]
  326. ===== Documents and syncs
  327. The connector syncs the following objects and entities:
  328. * *Files*
  329. ** Includes metadata such as file name, path, size, content, etc.
  330. * *Folders*
  331. [NOTE]
  332. ====
  333. Due to a Dropbox issue, metadata updates to Paper files from Dropbox Paper are not immediately reflected in the Dropbox UI.
  334. This delays the availability of updated results for the connector.
  335. Once the metadata changes are visible in the Dropbox UI, the updates are available.
  336. ====
  337. [NOTE]
  338. ====
  339. * Content from files bigger than 10 MB won't be extracted by default. You can use the <<es-connectors-content-extraction-local, self-managed local extraction service>> to handle larger binary files.
  340. * Currently, the connector doesn't retrieve files from shared Team folders.
  341. * Permissions are not synced by default. If <<es-dls, document level security (DLS)>> is not enabled *all documents* indexed to an Elastic deployment will be visible to *all users with access* to that Elastic Deployment.
  342. ====
  343. [discrete#es-connectors-dropbox-client-sync-types]
  344. ====== Sync types
  345. <<es-connectors-sync-types-full,Full syncs>> are supported by default for all connectors.
  346. This connector also supports <<es-connectors-sync-types-incremental,incremental syncs>>.
  347. [discrete#es-connectors-dropbox-client-sync-rules]
  348. ===== Sync rules
  349. <<es-sync-rules-basic, Basic sync rules>> are identical for all connectors and are available by default.
  350. [discrete#es-connectors-dropbox-client-sync-rules-advanced]
  351. ====== Advanced sync rules
  352. [NOTE]
  353. ====
  354. A <<es-connectors-sync-types-full, full sync>> is required for advanced sync rules to take effect.
  355. ====
  356. The following section describes <<es-sync-rules-advanced,advanced sync rules>> for this connector.
  357. Advanced sync rules for Dropbox allow you to sync Dropbox files based on a query that matches strings in the filename.
  358. You can optionally filter the results of the query by `file_extensions` or `file_categories`.
  359. When both are provided, priority is given to `file_categories`.
  360. We have some examples below for illustration.
  361. [discrete#es-connectors-dropbox-client-sync-rules-advanced-example-1]
  362. *Example: Query only*
  363. [source,js]
  364. ----
  365. [
  366. {
  367. "query": "confidential"
  368. },
  369. {
  370. "query": "dropbox"
  371. }
  372. ]
  373. ----
  374. // NOTCONSOLE
  375. [discrete#es-connectors-dropbox-client-sync-rules-advanced-example-2]
  376. *Example: Query with file extension filter*
  377. [source,js]
  378. ----
  379. [
  380. {
  381. "query": "dropbox",
  382. "options": {
  383. "file_extensions": [
  384. "txt",
  385. "pdf"
  386. ]
  387. }
  388. }
  389. ]
  390. ----
  391. // NOTCONSOLE
  392. [discrete#es-connectors-dropbox-client-sync-rules-advanced-example-3]
  393. *Example: Query with file category filter*
  394. [source,js]
  395. ----
  396. [
  397. {
  398. "query": "test",
  399. "options": {
  400. "file_categories": [
  401. {
  402. ".tag": "paper"
  403. },
  404. {
  405. ".tag": "png"
  406. }
  407. ]
  408. }
  409. }
  410. ]
  411. ----
  412. // NOTCONSOLE
  413. [discrete#es-connectors-dropbox-client-sync-rules-advanced-limitations]
  414. *Limitations*
  415. * Content extraction is not supported for Dropbox *Paper* files when advanced sync rules are enabled.
  416. [discrete#es-connectors-dropbox-client-end-to-end-testing]
  417. ===== End-to-end Testing
  418. The connector framework enables operators to run functional tests against a real data source.
  419. Refer to <<es-build-connector-testing>> for more details.
  420. To perform E2E testing for the Dropbox connector, run the following command:
  421. [source,shell]
  422. ----
  423. $ make ftest NAME=dropbox
  424. ----
  425. For faster tests, add the `DATA_SIZE=small` flag:
  426. [source,shell]
  427. ----
  428. make ftest NAME=dropbox DATA_SIZE=small
  429. ----
  430. [discrete#es-connectors-dropbox-client-known-issues]
  431. ===== Known issues
  432. Refer to <<es-connectors-known-issues>> for a list of known issues for all connectors.
  433. [discrete#es-connectors-dropbox-client-troubleshooting]
  434. ===== Troubleshooting
  435. See <<es-connectors-troubleshooting>> for a list of troubleshooting tips for all connectors.
  436. [discrete#es-connectors-dropbox-client-security]
  437. ===== Security
  438. See <<es-connectors-security>> for a list of security tips for all connectors.
  439. [discrete#es-connectors-dropbox-client-content-extraction]
  440. ===== Content extraction
  441. See <<es-connectors-content-extraction>>.
  442. // Closing the collapsible section
  443. ===============