本文以一个数据示例介绍通过 CKafka 连接器进行数据处理的过程中如何对日期格式数据进行处理。
日期格式处理
1. 输入带日期格式的原始数据,以下为一个示例。
{"@timestamp": "2022-02-26T22:25:33.210Z","beat": {"hostname": "test-server","ip": "6.6.6.6","version": "5.6.9"},"input_type": "log","message": "{\\"userId\\":888,\\"userName\\":\\"testUser\\"}","offset": 3030131}
2. 解析结果如下:
![](https://qcloudimg.tencent-cloud.cn/image/document/56e7c7efcf1d1867798e8d17cefa067f.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/56e7c7efcf1d1867798e8d17cefa067f.png)
3. 在数据处理模块通过 处理 value 功能来对日期数据进行处理。
![](https://qcloudimg.tencent-cloud.cn/image/document/3d8fd447e693fb31e24aa97702a0484d.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/3d8fd447e693fb31e24aa97702a0484d.png)
4. 处理模式选择转换时间格式,选择好时间格式、时区和日期格式,并确认。
![](https://qcloudimg.tencent-cloud.cn/image/document/7092dcfc8d1ab497fe68260cb30817d4.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/7092dcfc8d1ab497fe68260cb30817d4.png)
5. 单击测试,可以看到转换后的时间格式。
![](https://qcloudimg.tencent-cloud.cn/image/document/8bd8ec55e922185bb3df8b4dbf8c918e.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/8bd8ec55e922185bb3df8b4dbf8c918e.png)