Table of Contents

Prototype: readintlist(filename, comment, split, maxentries, maxbytes)
Prototype: readreallist(filename, comment, split, maxentries, maxbytes)
Prototype: readstringlist(filename, comment, split, maxentries, maxbytes)

Return type: ilist, rlist or slist

Description: Splits the file filename into separated values and returns the list.

The comment regex will strip out unwanted patterns from the file being read, leaving unstripped characters to be split into fields. Using the empty string ("") indicates no comments.


  • filename : File name to read, in the range "?(/.*)
  • comment : Unanchored regex matching comments, in the range .*
  • split : Unanchored regex to split data, in the range .*
  • maxentries : Maximum number of entries to read, in the range 0,99999999999
  • maxbytes : Maximum bytes to read, in the range 0,99999999999



echo 1 > /tmp/cfe_list_ints
echo 2 >> /tmp/cfe_list_ints
echo 3 >> /tmp/cfe_list_ints
echo 1.1 > /tmp/cfe_list_reals
echo 2.2 >> /tmp/cfe_list_reals
echo 3 >> /tmp/cfe_list_reals
echo alpha > /tmp/cfe_list_strings
echo beta >> /tmp/cfe_list_strings
echo gamma >> /tmp/cfe_list_strings


body common control
      bundlesequence => { "example" };

bundle agent example

      "integers" ilist => readintlist("/tmp/cfe_list_ints","#.*","[\n]",10,400);
      "strings" slist => readstringlist("/tmp/cfe_list_strings", "#.*", "\s", 10, 400);
      "reals" rlist => readreallist("/tmp/cfe_list_reals","#.*","[\n]",10,400);


      "integers in /tmp/cfe_list_ints: $(integers)";
      "strings in /tmp/cfe_list_strings: $(strings)";
      "reals in /tmp/cfe_list_reals: $(reals)";



R: integers in /tmp/cfe_list_ints: 1
R: integers in /tmp/cfe_list_ints: 2
R: integers in /tmp/cfe_list_ints: 3
R: strings in /tmp/cfe_list_strings: alpha
R: strings in /tmp/cfe_list_strings: beta
R: strings in /tmp/cfe_list_strings: gamma
R: reals in /tmp/cfe_list_reals: 1.1
R: reals in /tmp/cfe_list_reals: 2.2
R: reals in /tmp/cfe_list_reals: 3