Trying to add fields to CSV and fill them with data

Hi and thanks for reading and helping. Posting because my search got nothing I can use.
I am uploading .csv files from a directory structure that represents countries.
The filenames don't give me anything but the date.
Example:

/path/to/france/file_01012017.csv
/path/to/germany/file_01022017.csv

I would like to:

  1. Use "france" as the index for example
    index => "logstash_france_%{datetime}"
  2. Add a column to the output and put "france" in it for all the records

I tried to understand how to use add_field or something similar, but would appreciate any advice.

Thanks !
JD

Use a grok filter to parse the path field which contains the whole file path. Store the directory component containing the country in a field that you then reference in the output configuration.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.