Skip to main content
Version: 1.x

Date

Filter plugin : Date​

Description​

The date filter is used for parsing dates from specified field.

Options​

nametyperequireddefault value
default_valuestringno${now}
localestringnoLocale.US
source_fieldstringno__root__
source_time_formatstringnoUNIX_MS
target_fieldstringnodatetime
target_time_formatstringnoyyyy/MM/dd HH:mm:ss
time_zonestringno-
default_value [string]​

If the date conversion fails, the current time(${now}) will be used in the specified format.

locale [string]​

Locale of source field.

source_field [string]​

Source field, if not configured, the current time will be used.

source_time_format [string]​

Source field time format, currently supports UNIX(10-bit seconds timestamp), UNIX_MS(13-bit millisecond timestamp) and SimpleDateFormat format. The commonly used time formats are listed below:

SymbolDescription
yYear
MMonth
dDay of month
HHour in day (0-23)
mMinute in hour
sSecond in minute

The detailed time format syntax:Java SimpleDateFormat.

target_field [string]​

Target field, default is datetime.

target_time_format [string]​

Target field time format, The detailed time format syntax:Java SimpleDateFormat.

time_zone [string]​

Timezone of source field

Examples​

date {
source_field = "timestamp"
target_field = "date"
source_time_format = "UNIX"
target_time_format = "yyyy/MM/dd"
}

Convert the timestamp field from UNIX timestamp to the yyyy/MM/dd format.

date {
source_field = "httpdate"
target_field = "datetime"
source_time_format = "dd/MMM/yyyy:HH:mm:ss Z"
target_time_format = "yyyy/MM/dd HH:mm:ss"
}

Convert the httpdate field from dd/MMM/yyyy:HH:mm:ss Z format to the yyyy/MM/dd HH:mm:ss format