# Logstash TCP Client configuration

**URL:** <https://discuss.elastic.co/t/logstash-tcp-client-configuration/45716>\
**Category:** Logstash\
**Created:** [March 29, 2016, 5:23pm UTC](https://discuss.elastic.co/t/logstash-tcp-client-configuration/45716 "2016-03-29T17:23:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joseph\_Schwartz](https://avatars.discourse-cdn.com/v4/letter/j/7ba0ec/32.png) [@Joseph\_Schwartz](https://discuss.elastic.co/u/Joseph_Schwartz)\
**Post date:** [March 29, 2016, 5:23pm UTC](https://discuss.elastic.co/t/logstash-tcp-client-configuration/45716/1 "2016-03-29T17:23:54Z")

</div>

I'm looking for an better example to connect to a TCP server and save the results of a CSV stream to a file or directly into elastic. Does anyone have good example to work with?

Sample of CSV Data:  
1ADLAA1,GSM,1458229111.998,I,SAI ,I,003.030.004,007.128.007, 529R ,BN900002,00,3502, 140445570240, 5119550011305718, , ,007,006,000,000,09,ITU Transaction Begin,ITU Completion Invoke,

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [March 29, 2016, 8:46pm UTC](https://discuss.elastic.co/t/logstash-tcp-client-configuration/45716/2 "2016-03-29T20:46:24Z")

</div>

LS won't connect to a TCP server, it can only listen on a port.

---

<div class="post-metadata">

**Author:** ![Joseph\_Schwartz](https://avatars.discourse-cdn.com/v4/letter/j/7ba0ec/32.png) [@Joseph\_Schwartz](https://discuss.elastic.co/u/Joseph_Schwartz)\
**Post date:** [April 29, 2016, 8:32pm UTC](https://discuss.elastic.co/t/logstash-tcp-client-configuration/45716/3 "2016-04-29T20:32:23Z")

</div>

I found the solution to my own problem. I was able to connect to a socket and collect the data from the system. Here is my config:

input {  
tcp {  
mode =\> client  
host =\> "192.168.25.93"  
port =\> "5001"}  
}

filter {  
csv {  
columns =\> ['unit','prot','time','dir','msg','dir msu','opc','dpc','link','linkset','slc','corr','ogt','dgt','cgpc','cdpc','cgssn','cdssn','cgtt','cdtt','sccpmsg','package','component']  
#convert =\> { "column1" =\> "string",}  
separator =\> ","}

# test things here

}

#output { stdout { codec =\> rubydebug }  
output {  
elasticsearch {

# index =\> "Peg%{IndexType}-%{+YYYY.MM.dd}"

}

}

# then run it with:

# /opt/logstash/bin/logstash -f stub.conf

# and paste in some input that will trigger the filters.

---

<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:** [July 6, 2017, 4:59am UTC](https://discuss.elastic.co/t/logstash-tcp-client-configuration/45716/4 "2017-07-06T04:59:56Z")

</div>


