I have a log file which I want to send to elasticsearch.
log.txt:
abc
de
fg
The problem is:
-
If I use filebeat, it will treat every line as a document. Of course, I could set some multiline regular expression, but here no special rules I could give because file contents are different from files to files.
-
Then, I tried to send the whole contents of files to elasticsearch like next:
curl -XPUT 'localhost:9200/text/article/2' -H 'Content-Type: application/json' -d ' { "my_text":"abc\r\nde.\r\nfg\r\n" }'
My question is, do we have some command which could directly send a text file's contents to elasticsearch? Or any sdk could help me?