No release in over 3 years
Low commit activity in last 3 years
fluent-plugin-auto-typecast-filter
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.0.2
~> 1.7.0
~> 10.0
~> 1.2.3
 Project Readme

Fluent::Plugin::AutoTypecastFilter CircleCI Gem Version

This plug-in helps to automatically cast and retransmit structured log data flowing through the Fluent network.

Tested dependencies

  • fluentd v1.7.0

Installation

gem install fluent-plugin-auto-typecast-filter

or

# for `fluent-gem` users:
fluent-gem install fluent-plugin-auto-typecast-filter

Usage

Basic usage in fluentd.conf:

<filter any.tag.**>
    @type auto_typecast
</filter>

Parameters

Parameter Description Type Default
maxdepth Maximum level of nesting that is autocast. If 0 is specified, all nests are targeted. Integer 1
ignore_key_regexp Regular expression to determine keys that are not subject to processing. RegExp nil

Examples

Case 1:

# CONFIG:
maxdepth 0

# INPUT:
{ 'k': { 'k': { 'k': [ { 'k': {
    'k0': 'string',
    'k1': '20',
    'k2': '1.0',
    'k3': 'NULL',
    'k4': 'true'
} } ] } } }

# FILTERED OUTPUT:
{ 'k': { 'k': { 'k': [ { 'k': {
    'k0': 'string',
    'k1': 20,
    'k2': 1.0,
    'k3': null,
    'k4': true
} } ] } } }

Case 2:

# CONFIG:
maxdepth 3

# INPUT:
{ 'k' : {
    'k0': [ '10', '20', '30' ],
    'k1': { 'k': [ '10', '20', '30' ] }
}

# FILTERED OUTPUT:
{ 'k' : {
    'k0': [ 10, 20, 30 ]
    'k1': { 'k': [ '10', '20', '30' ] }
}

Case 3:

# CONFIG:
maxdepth 0
ignore_key_regexp /^0$/

# INPUT:
{ 'k': [
    [ '10', '20' ], [
    [ '100', '200' ], [
    [ '1000', '2000' ]
] ] ] }

# FILTERED OUTPUT:
{ 'k': [
    [ '10', 20 ], [
    [ '100', 200 ], [
    [ '1000', 2000 ]
] ] ] }

Case 4:

# CONFIG:
maxdepth 0
ignore_key_regexp /^[a-z]{1}[0-9]{1,}1$/

# INPUT:
{ 'k0001': [ {
    'k0000': 'true',
    'k0002': {
    'j0001': 'null'
} } ] }

# FILTERED OUTPUT:
{ 'k0001': [ {
    'k0000': true,
    'k0002': {
    'j0001': 'null'
} } ] }

Copyright

  • Copyright (c) 2019- Shotaro Chiba
  • Apache License, Version 2.0