Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is there any way to put a relative path in the conf files?

Tags:

logstash

Well, I've been the following problem . I've got my workspace the following way

bin  conf  example  lib  LICENSE  locales  patterns  README.md  spec  vendor

In the conf folder I've got the file logstash-apache.conf with the next input

input {
  file {
    path => "./../example/logs/logprueba/*_log"
    start_position => beginning   }
  }
}

When I run logstash, I get the message:

File paths must be absolute, relative path specified: ./../example/logs/logprueba/*_log

Is there any way to put a relative path?

like image 458
xusliebana Avatar asked Oct 23 '14 11:10

xusliebana


People also ask

How do you set a relative path?

You can also set this option by right-clicking the script tool, clicking Properties, then clicking the General tab. At the bottom of the dialog box, check Store relative path names (instead of absolute paths).


2 Answers

The answer is no -- not without modifying the logstash source code... According to the docs:

The path(s) to the file(s) to use as an input. You can use globs here, such as /var/log/*.log Paths must be absolute and cannot be relative.

like image 140
Alcanzar Avatar answered Sep 29 '22 02:09

Alcanzar


You can always use the environment variables using bash $(pwd) to yield the current destination, this could not be the master solution for you but at least is not anti-pattern:

export CSV_FILE=$(pwd)\/temporal_datasets\/dataset.csv

then in the logstash config file

input {
  file {
    path => '${CSV_FILE}'
    start_position => "beginning"
    sincedb_path => "/dev/null"
    ignore_older => 0
  }
}
like image 22
panchicore Avatar answered Sep 29 '22 00:09

panchicore