Skip to content

[QUESTION]: 在虚拟机上采集日志文件,如果使用纳秒时间? #2480

@alexandnpu

Description

@alexandnpu

版本

loongcollector-3.1.4

配置

enable: true
global:
  EnableTimestampNanosecond: true
inputs:
  - Type: input_file
    FilePaths:
    - /path/to/my/logs/*.log

processors:
  - Type: processor_add_fields
    Fields:
      host: my-host
      app: my-app

  - Type: processor_rename
    SourceKeys:
      - content
    DestKeys:
      - message

flushers:
  - Type: flusher_kafka_v2
    Brokers:
      - my-kafka-brokers
    Topic: my-topic
    RequiredAcks: 0
    Compression: gzip
    CompressionLevel: 1
    Convert:
      Protocol: custom_single_flatten
      TagFieldsRename:
        host.ip: ""

在这个配置里,我设置了EnableTimestampNanosecond: true

但是在kafka消费侧,我得到的却是下面的结果

{
  "__host_ip__": "xx.xx.xx.xx",
  "app": "my-app",
  "host": "my-host",
  "host.name": "my-host-name",
  "log.file.path": "/path/to/my/logs/*.log",
  "message": "mylog",
  "time": 1764663807
}

请问如何才能让time字段变成纳秒呢?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions