Can we use " :: " as a separator in csv filter in logstash

Can we use following csv filter:
I cannot test this directly in our system.

csv {
                                  columns => [ "LogLevel", "DateTime", "RequestID", "LogMessage" ]
                                    separator => " :: "
                                    skip_header => "false"
                                }


Tested with 7.9

input {
  generator {
    lines => [
     'LogLevel :: DateTime :: RequestID :: LogMessage'
    ]
    count => 1
    codec => "line"
  }
}
filter {
    csv {
        columns => [ "LogLevel", "DateTime", "RequestID", "LogMessage" ]
        separator => " :: "
        skip_header => "false"
    }
}
output {
  stdout { codec =>  "rubydebug" }
}

Output

{
      "DateTime" => "DateTime",
     "RequestID" => "RequestID",
      "@version" => "1",
    "@timestamp" => 2020-08-31T16:46:36.698Z,
          "host" => "MacBook-Pro.domain",
      "LogLevel" => "LogLevel",
       "message" => "LogLevel :: DateTime :: RequestID :: LogMessage",
    "LogMessage" => "LogMessage"
}

So the answer is yes.

Thanks. You are awesome. Just one last thing - I guess I will have to install logstash on my machine to test this. How do I test this after installing logstash - what commands, configuration?

Get the download and follow the steps.

The -f filename.conf is the only part you need to change. Which is the path to the .conf file you create.

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