Carlos Aguni

Highly motivated self-taught IT analyst. Always learning and ready to explore new skills. An eternal apprentice.


FluentD time formats

28 Jul 2022 »

[26/Jul/2022 05:55:22 -0700]

<source>
    @type tail
    path /opt/hue.log
    tag log.unprocessed
    read_from_head true

    <parse>
        @type multiline
        format_firstline /\[\d+\/\w+\/\d{4} \d+:\d+:\d+([^]]+)\]\s+\w+\s+\w+/
        format1 /\[(?<time>\d+\/\w+\/\d{4} \d+:\d+:\d+([^]]+))\]\s+(?<component>\w+)\s+(?<log_lvl>\w+) (?<message>.*)/

        time_key time
        time_format %d/%b/%Y %H:%M:%S %z
        #keep_time_key true
    </parse>
</source>

2015-10-15 08:19:05,190

<source>
    @type tail
    path /opt/test
    tag log.unprocessed
    read_from_head true

    <parse>
        @type multiline
        format_firstline /\d{4}-\d{1,2}-\d{1,2} \d{1,2}:\d{1,2}:\d{1,2},\d{3}/
        format1 /(?<time>\d{4}-\d{1,2}-\d{1,2} \d{1,2}:\d{1,2}:\d{1,2},\d{3}) (?<message>(.|\s)*)/

        time_key time
        time_format %Y-%m-%d %H:%M:%S,%L
        keep_time_key true
    </parse>
</source>