edit-icon download-icon

Configure LogHub Writer

Last Updated: Mar 21, 2018

LogHub Writer uses the Java SDK of Log Service to push data from DataX Reader to a specific Log Service LogHub so that the data can be consumed by other applications.

Note:

Given that LogHub cannot implement idempotence, re-running the task upon failover results in data duplication.

How it works

LogHub Writer acquires the data generated by Reader by means of the Datax framework and individually converts the data types supported by Datax to the String type. When the specified batchSize is reached, LogHub Writer pushes the data to LogHub in one operation using the Java SDK of Log Service. 1,024 entries of data is pushed at a time by default. The maximum batchSize is 4,096.

The following table shows the conversion of LogHub Writer for different LogHub data types:

Internal DataX type LogHub data types
Long String
Double String
String String
Date String
Boolean String
Bytes String

Parameter description

  • endpoint

    • Description: Log Service address

    • Required: Yes

    • Default value: None

  • accessKeyID

    • Description: AccessKeyID for accessing Log Service

    • Required: Yes

    • Default value: None

  • accessKeySecret

    • Description: AccessKeySecret for accessing Log Service

    • Required: Yes

    • Default value: None

  • project

    • Description: Project name of target Log Service

    • Required: Yes

    • Default value: None

  • logstore

    • Description: LogStore name of target Log Service

    • Required: Yes

    • Default value: None

  • topic

    • Description: Selected topic

    • Required: No

    • Default value: Null string

  • batchSize

    *Description: Number of pushed data at a time

    *Required: No. The default value is 1,024.

    • Default value: None
  • column

    *Description: Column names in each data entry

    • Required: Yes

    • Default value: None

      Note: The data is considered as dirty data if the number of columns is inconsistent with that of the data source.

Development in script mode

The following is a script configuration sample. For more information about parameters, see the preceding Parameter description.

  1. {
  2. "type": "job",
  3. "version": "1.0",
  4. "configuration": {
  5. "setting": {
  6. "errorLimit": {
  7. "record": "0"
  8. },
  9. "speed": {
  10. "mbps": "1",
  11. "concurrent": "1"
  12. }
  13. },
  14. "reader": {
  15. "plugin": "odps",
  16. "parameter": {
  17. "accessKey": "*****",
  18. "accessId": "*****",
  19. "isCompress": "false",
  20. "odpsServer": "http://service-corp.odps.aliyun-inc.com/api",
  21. "project": "xxxx",
  22. "table": "ttt",
  23. "column": [
  24. "*"
  25. ],
  26. "partition": "pt=20161226"
  27. }
  28. },
  29. "writer": {
  30. "plugin": "loghubwriter",
  31. "parameter": {
  32. "endpoint": "http://cn-hangzhou.sls.aliyuncs.com",
  33. "accessId": "*****",
  34. "accessKey": "*****",
  35. "project": "ggg",
  36. "logstore": "store",
  37. "batchSize": 1096,
  38. "topic": "",
  39. "column": [
  40. "col0",
  41. "col1",
  42. "col2",
  43. "col3",
  44. "col4",
  45. "col5",
  46. "col6",
  47. "col7",
  48. "col8",
  49. "col9"
  50. ]
  51. }
  52. }
  53. }
  54. }
Thank you! We've received your feedback.