Help Center/ Log Tank Service/ Best Practices/ Log Jobs (Beta)/ Processing Log Data Using DSL Functions/ Scenario 7: Converting Data to Nanosecond-Level Unix Timestamps
Updated on 2025-12-04 GMT+08:00

Scenario 7: Converting Data to Nanosecond-Level Unix Timestamps

You can use LTS's data processing feature to enable nanosecond-precision timestamps. For raw logs that contain Unix time fields, use the e_set operation function to parse these fields into nanosecond-level timestamps.

  • Raw log
    {
      "source": "1.2.3.4",
      "time": 1704983810,
      "topic": "test",
      "log_time_nano":"1705043680630940602"
    }
  • Processing rule
    e_set(
        "time", op_div_floor(ct_int(v("log_time_nano")), 1000000000),
    )
    e_set(
        "time_ns_part", op_mod(ct_int(v("log_time_nano")), 1000000000),
    )
  • Processing result
    {
    	"time_ns_part": 630940602,
    	"log_time_nano": "1705043680630940602",
    	"topic": "test",
    	"source": "1.2.3.4",
    	"time": 1705043680
    }