The readFile() function outputs the content of CSV lookup files or ad-hoc tables as events. This allows you to use a CSV Lookup File and ad-hoc table as data input. For more information about ad-hoc tables, see Using Ad-hoc Tables.

Note

It is recommended to use the readFile() function at the beginning of the query. Using the function later in the query will always discard anything before it, and only return the content of the files or tables.

ParameterTypeRequiredDefault ValueDescription
file[a]array of file/table namesrequired   The names of the input files or input tables. You can use table as the parameter name instead of file.
includearray of stringsoptional[b]   Specifies the column names to read in the lookup file. If no argument is given, all columns are included.
limitnumberoptional[b]   Limits the number of rows returned. Use limit=N to preview the first N rows of the files and tables. The files or tables will be outputted in the specified order, until the limit has been reached.
  Minimum1 

[a] The parameter name file can be omitted.

[b] Optional parameters use their default value unless explicitly set.

Hide omitted argument names for this function

Show omitted argument names for this function

The readFile() function requires one of these file or table sources to be available:

  • An uploaded file (see Uploading Files).

  • An ad-hoc table defined in the query.

  • An installed package file.

When using the readFile() function, it will output each file or table as an event per row. The order of the output is as follows:

  • The files or tables will be outputted in the order specified in the file or table parameter.

  • For each file or table, the rows will be outputted as events in the order they are in the file or table.

When reading a file from a package, the package name should be specified in addition to the filename. For example:

logscale
readFile("falcon/investigate/logoninfo.csv")

For more information on referring to package resources, see Referencing Package Assets.

If you are aiming to preview the content of large files, LogScale recommends always including the limit parameter to ensure optimal UI performance. However, when the file is utilized as data input for further manipulation, the limit parameter can be omitted.

readFile() Examples

Click + next to an example below to get the full details.

Preview Content in a Lookup File With readFile()

Preview content in a lookup file in the search portion of a repo without having to match the lookup against data

Preview Content in a Lookup File With readFile() and Filter With !join()

Preview content in a lookup file in the search portion of a repo and filter for specific data with the !join() function

Perform a Right Join Query to Combine Two Datasets