Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
fluent-bit example config/output for https://github.com/fluent/fluent-bit/pull/531

Nest/Lift

Nest 1

[INPUT]
    Name mem
    Tag  mem.local

[OUTPUT]
    Name  stdout
    Match *

[FILTER]
    Name nest
    Match *
    Operation nest
    Wildcard Mem.*
    Nest_under LAYER1

Output,

[0] mem.local: [1524795567.010244325, {"Swap.total"=>1046524, "Swap.used"=>0, "Swap.free"=>1046524, "LAYER1"=>{"Mem.total"=>4050908, "Mem.used"=>1101372, "Mem.free"=>2949536}}]

{
  "Swap.total"=>1046524,
  "Swap.used"=>0,
  "Swap.free"=>1046524,
  "LAYER1"=>{
   "Mem.total"=>4050908,
   "Mem.used"=>1101372,
   "Mem.free"=>2949536
  }
}

Nest 1 - Lift 1

[INPUT]
    Name mem
    Tag  mem.local

[OUTPUT]
    Name  stdout
    Match *

[FILTER]
    Name nest
    Match *
    Operation nest
    Wildcard Mem.*
    Nest_under LAYER1

[FILTER]
    Name nest
    Match *
    Operation lift
    Nested_under LAYER1

Output,

[0] mem.local: [1524795757.002111309, {"Swap.total"=>1046524, "Swap.used"=>0, "Swap.free"=>1046524, "Mem.total"=>4050908, "Mem.used"=>1112044, "Mem.free"=>2938864}]

{
  "Swap.total"=>1046524, 
  "Swap.used"=>0,
  "Swap.free"=>1046524, 
  "Mem.total"=>4050908, 
  "Mem.used"=>1112044, 
  "Mem.free"=>2938864
}

Nest 1/2/3

[INPUT]
    Name mem
    Tag  mem.local

[OUTPUT]
    Name  stdout
    Match *

[FILTER]
    Name nest
    Match *
    Operation nest
    Wildcard Mem.*
    Nest_under LAYER1

[FILTER]
    Name nest
    Match *
    Operation nest
    Wildcard LAYER1*
    Nest_under LAYER2

[FILTER]
    Name nest
    Match *
    Operation nest
    Wildcard LAYER2*
    Nest_under LAYER3

Output,

 [0] mem.local: [1524795923.009867831, {"Swap.total"=>1046524, "Swap.used"=>0, "Swap.free"=>1046524, "LAYER3"=>{"LAYER2"=>{"LAYER1"=>{"Mem.total"=>4050908, "Mem.used"=>1112036, "Mem.free"=>2938872}}}}]

 {
   "Swap.total"=>1046524,
   "Swap.used"=>0,
   "Swap.free"=>1046524,
   "LAYER3"=>{
     "LAYER2"=>{
       "LAYER1"=>{
         "Mem.total"=>4050908,
         "Mem.used"=>1112036,
         "Mem.free"=>2938872
       }
     }
   }
 }

Nest 1/2/3 - Lift 3/2

[INPUT]
    Name mem
    Tag  mem.local

[OUTPUT]
    Name  stdout
    Match *

[FILTER]
    Name nest
    Match *
    Operation nest
    Wildcard Mem.*
    Nest_under LAYER1

[FILTER]
    Name nest
    Match *
    Operation nest
    Wildcard LAYER1*
    Nest_under LAYER2

[FILTER]
    Name nest
    Match *
    Operation nest
    Wildcard LAYER2*
    Nest_under LAYER3

[FILTER]
    Name nest
    Match *
    Operation lift
    Nested_under LAYER3

[FILTER]
    Name nest
    Match *
    Operation lift
    Nested_under LAYER2

Output,

[0] mem.local: [1524795834.019236872, {"Swap.total"=>1046524, "Swap.used"=>0, "Swap.free"=>1046524, "LAYER1"=>{"Mem.total"=>4050908, "Mem.used"=>1112152, "Mem.free"=>2938756}}]

{
  "Swap.total"=>1046524,
  "Swap.used"=>0,
  "Swap.free"=>1046524, 
  "LAYER1"=>{
    "Mem.total"=>4050908, 
    "Mem.used"=>1112152, 
    "Mem.free"=>2938756
  }
}

Nest 1/2/3 - Lift 3/2/1

[INPUT]
    Name mem
    Tag  mem.local

[OUTPUT]
    Name  stdout
    Match *

[FILTER]
    Name nest
    Match *
    Operation nest
    Wildcard Mem.*
    Nest_under LAYER1

[FILTER]
    Name nest
    Match *
    Operation nest
    Wildcard LAYER1*
    Nest_under LAYER2

[FILTER]
    Name nest
    Match *
    Operation nest
    Wildcard LAYER2*
    Nest_under LAYER3

[FILTER]
    Name nest
    Match *
    Operation lift
    Nested_under LAYER3

[FILTER]
    Name nest
    Match *
    Operation lift
    Nested_under LAYER2

[FILTER]
    Name nest
    Match *
    Operation lift
    Nested_under LAYER1

Output,

[0] mem.local: [1524795951.007280437, {"Swap.total"=>1046524, "Swap.used"=>0, "Swap.free"=>1046524, "Mem.total"=>4050908, "Mem.used"=>1112192, "Mem.free"=>2938716}]

{
  "Swap.total"=>1046524, 
  "Swap.used"=>0, 
  "Swap.free"=>1046524, 
  "Mem.total"=>4050908, 
  "Mem.used"=>1112192, 
  "Mem.free"=>2938716
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment