Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to parse configuration items in Fluentd

Shulou Source: shulou.com Published: 2022-06-02 00:54:55 11月16日 Update

Some plug-ins in Fluentd support configuration items to customize parsing methods for input data.

For example, for a general application, the input to Fluentd is line by line of text, and developers can configure to parse the text into meaningful JSON objects to facilitate subsequent processing.

Parse Overview parse configuration items can be used in, or. If you use a plug-in that supports the parser feature, the parse configuration item takes effect. @ type tail # parameters for input plugin # parse section parameters

Here, the input to tail needs to be parsed by the parser specified by parse.

Parser plug-in type

The configuration item needs to specify the type of parser through the @ type parameter. The Fluentd kernel bundles many useful parser plug-ins, and you can install other third-party parsers as needed. @ type apache2

Here, @ type specifies that the apache2 parser is used to parse the input log.

Parse parameter description @ typeFluentd built-in parsers include: regexp, apache2, apache_error, nginx, syslog, csv, tsv, ltsv, json, multiline, none

Optional parameters, the default values of these parameters will change depending on the parser used, you can refer to the instructions for the use of the relevant parser. Types: data types used to convert fields. Supported data types are: string, bool, integer, float, timetypes user_id:integer,paid:bool,paid_usd_amount:float

Time_key: specifies the field used by the event time attribute. If the event does not contain this field, the current time keep_time_key:true will be used and the time field in record will be retained. Default falsetimeout: sets the parsing processing timeout, which is mainly used to detect regular matching of errors.

Further explanation of time if you parse a field of record to the time of an event, you need to explain how to parse this "time field". This can be described by the following parameters. Time_type: the time format used in the time field, which supports float, unixtime, and string formats. Float: seconds from Epoch + nano seconds (e.g. 1510544836.154709804) unixtime: seconds from Epoch (e.g. 1510544815) string: use format specified by time_format, localtime or time zonetime_format: used to describe the time format when time_type is string, localtime:true uses localtime as the timeutc:true of the event, UTC is used as the time of the event, and the localtime above is a mutually exclusive configuration timezone: time zone format

Tags: Fields configuration time events parameters plug-ins formats types support input data text e.g. processing different one line above instructions for use kernel available through the Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker macOS Shulou Information Shulou Tech Info Apple