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

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



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


logstash-apache.conf


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


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



Is there any way to put a relative path?






it's not really a relative path, but since recent logstash includes support for environment variable expansion in the conf file (may need to pass --allow-env depending on version) if you're willing to always run logstash from a particular directory (the one with the conf file in it, for instance), you could use path => "$PWD/../example/logs/logprueba/*_log". Alternatively, if you're willing to set a var, path => "$LOGS_DIR/*_log"

– James Manning
Sep 29 '16 at 22:52




2 Answers
2



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.



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:


$(pwd)



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


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




Thanks for contributing an answer to Stack Overflow!



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)