# Several questions about logstash and filebeat

**URL:** <https://discuss.elastic.co/t/several-questions-about-logstash-and-filebeat/120999>\
**Category:** Logstash\
**Created:** [February 22, 2018, 7:30am UTC](https://discuss.elastic.co/t/several-questions-about-logstash-and-filebeat/120999 "2018-02-22T07:30:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jaas](https://avatars.discourse-cdn.com/v4/letter/j/a4c791/32.png) [@jaas](https://discuss.elastic.co/u/jaas)\
**Post date:** [February 22, 2018, 7:30am UTC](https://discuss.elastic.co/t/several-questions-about-logstash-and-filebeat/120999/1 "2018-02-22T07:30:36Z")

</div>

1.I am dealing with a database export file like this  
Nokia^A20180101^A1999.99 ^A RM-356 ^A1 ^A/UCWEB8.9.0.253/50/999^A20171209

and ^A is the delimeter. I checked [https://github.com/kkos/oniguruma/blob/master/doc/RE#L400](https://github.com/kkos/oniguruma/blob/master/doc/RE#L400) to find ^A without a result.  
Would you mind give a hint on how to write the grok code?I used \u0001 but failed.

```
grok {
     match => {"message" => "%{DATA:product}\u0001%{DATA:startdate}\u0001%{DATA:amount}\u0001%{DATA:style}\u0001%{DATA:order}\u0001%{DATA:browers}\u0001%{DATA:enddate}"}
 }

```

1. Under filebeat's directory, I have different .txt file to harvest, for example, the file named _JGXX_.txt to match format 1 , _YGXX_.txt to match format 2 and so on. Would you mind tell me how to deal with this?

3.I have the create tables sql file and I'd like to know is there a wheel or tool which can convert sql to mapping or template so I can load into elasticsearch?

Thank you.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [February 22, 2018, 7:38am UTC](https://discuss.elastic.co/t/several-questions-about-logstash-and-filebeat/120999/2 "2018-02-22T07:38:25Z")

</div>

> Under filebeat's directory, I have different .txt file to harvest, for example, the file named JGXX.txt to match format 1 , YGXX.txt to match format 2 and so on. Would you mind tell me how to deal with this?

I can think of a couple of options.

- On the Filebeat side, use different prospectors and set a field or a tag to indicate what kind of file it is, then use Logstash conditionals to process them differently.
- If the filename itself indicates the file type you can use Logstash conditionals that inspect the field containing the path of the source file.

---

<div class="post-metadata">

**Author:** ![jaas](https://avatars.discourse-cdn.com/v4/letter/j/a4c791/32.png) [@jaas](https://discuss.elastic.co/u/jaas)\
**Post date:** [February 22, 2018, 7:45am UTC](https://discuss.elastic.co/t/several-questions-about-logstash-and-filebeat/120999/3 "2018-02-22T07:45:19Z")

</div>

Thank you for your reply.And I will try both methods.  
I am building a system which can analysis transaction data(database export file), is there any example I can follow?I am a fresh new in this architechure(filebeat,logstash,elasticsearch,kibana).  
Thanks again for your kindess reply.

---

<div class="post-metadata">

**Author:** ![jaas](https://avatars.discourse-cdn.com/v4/letter/j/a4c791/32.png) [@jaas](https://discuss.elastic.co/u/jaas)\
**Post date:** [February 28, 2018, 6:05am UTC](https://discuss.elastic.co/t/several-questions-about-logstash-and-filebeat/120999/4 "2018-02-28T06:05:18Z")

</div>

for the first question, I handle it with filter mutate.

^A is a delimeter for Hive and it can be write in vim by ctrl +v, ctrl+a,so  
split =\> ["message","^A"]

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 28, 2018, 6:05am UTC](https://discuss.elastic.co/t/several-questions-about-logstash-and-filebeat/120999/5 "2018-03-28T06:05:22Z")

</div>

Closed on March 28, 2018, 6:05am UTC

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