Syslog through TCP protocol?

Status
Not open for further replies.

Discofris

Cadet
Joined
May 11, 2012
Messages
1
I'm using syslog to send logs to my Splunk install. This is done via UDP protocol (default setting). How can I configure syslog on my FreeNAS 8.0.4 to have it communicate via TCP?
 

peterh

Patron
Joined
Oct 19, 2011
Messages
315
You don't.

What could be done is to tunnel udp/514 with ssh ( or any other tunnel )
 
Joined
Jun 17, 2013
Messages
36
The default 'syslogd' in FreeBSD doesn't support TCP connections. A workaround for this might be to create a jail, install rsyslog in the jail and configure it to accept UDP syslog messages and then forward them on via TCP.
 

AlloAS

Cadet
Joined
Oct 16, 2014
Messages
1
edit "/usr/local/etc/syslog-ng.conf "

and change "destination loghost { tcp("@ip" port(514) localport(514)); };"

then restart syslog-ng "/usr/local/etc/rc.d/syslog-ng restart"
 

SweetAndLow

Sweet'NASty
Joined
Nov 6, 2013
Messages
6,421
I'm using syslog to send logs to my Splunk install. This is done via UDP protocol (default setting). How can I configure syslog on my FreeNAS 8.0.4 to have it communicate via TCP?
Curious to know why you need or want to use TCP?
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,525
That person hasn't been on the forums in 2 years.. so I doubt he'll answer you. ;)
 

SweetAndLow

Sweet'NASty
Joined
Nov 6, 2013
Messages
6,421
That person hasn't been on the forums in 2 years.. so I doubt he'll answer you. ;)
Ahh looks like they got me! I'd still like to know the reasoning for only supporting udp and/or why someone would want to use TCP.
 
Joined
Jun 17, 2013
Messages
36
Curious to know why you need or want to use TCP?

We have ~20 FreeNAS boxes that are "in the middle of nowhere" in Alaska, Washington, and Oregon. Their internet providers are terrible, lots of dropped packets, etc...

Getting syslog data is fairly important since we are contractually obligated to monitor those systems. :)
 

SweetAndLow

Sweet'NASty
Joined
Nov 6, 2013
Messages
6,421
A better solution would be to store the data locally on site and sync it to a mirror in your central location. You shouldn't use tcp to provide the type of data verification you want. You should use application level verification.
 
Joined
Jun 17, 2013
Messages
36
A better solution would be to store the data locally on site and sync it to a mirror in your central location. You shouldn't use tcp to provide the type of data verification you want. You should use application level verification.

I disagree. We pump a lot of data in to a logstash server to run reports, generate alerts, and watch trends. It's exactly what syslog was intended for. Running an rsync to copy the data locally would then require us to write a custom script to convert the log lines back into syslog messages for the logstash server. I'd rather just send them directly and reliably using TCP. I'll open the syslog/TLS argument later. ;)
 

Chris Hager

Dabbler
Joined
May 7, 2015
Messages
11
I know this is an old post but I recently went through this as well (for different reasons) and came up with the following solution.

Freenas will by default use UDP via the syslog-ng service. For whatever reason this wasn't playing nicely with our graylog syslog server. We suspected the timestamps were malformed (found via tcpdump) and graylog was refusing the packets. Our hack was to change a line in this file: /usr/local/etc/syslog-ng.conf.

destination loghost { udp("[ServerName]" port(514) localport(514)); };​

to:

destination loghost { syslog("[ServerName]" port(514) localport(514)); };​

This startup command keeps it constant after reboots since the file is overwritten at startup:

sed -i -e 's/{ udp(/{ syslog(/g' /usr/local/etc/syslog-ng.conf && service syslog-ng restart​

Since then we've been receiving syslog messages fine via TCP.
 

lethalduck

Cadet
Joined
Sep 5, 2016
Messages
2
I disagree. We pump a lot of data in to a logstash server to run reports, generate alerts, and watch trends. It's exactly what syslog was intended for. Running an rsync to copy the data locally would then require us to write a custom script to convert the log lines back into syslog messages for the logstash server. I'd rather just send them directly and reliably using TCP. I'll open the syslog/TLS argument later. ;)
Did you open the syslog/TLS discussion? Anyone would have to be slightly crazy to send logs over the internet unencrypted. My other servers all send their logs using TCP(some reliability)/TLS(some privacy) at a minimum. Even then messages are still lost occasionally, and that's where RELP comes to the party. I'd like to get this setup for the filer as well.
 
Last edited:

lethalduck

Cadet
Joined
Sep 5, 2016
Messages
2
I know this is an old post but I recently went through this as well (for different reasons) and came up with the following solution.

Freenas will by default use UDP via the syslog-ng service. For whatever reason this wasn't playing nicely with our graylog syslog server. We suspected the timestamps were malformed (found via tcpdump) and graylog was refusing the packets. Our hack was to change a line in this file: /usr/local/etc/syslog-ng.conf.

destination loghost { udp("[ServerName]" port(514) localport(514)); };​

to:

destination loghost { syslog("[ServerName]" port(514) localport(514)); };​

This startup command keeps it constant after reboots since the file is overwritten at startup:

sed -i -e 's/{ udp(/{ syslog(/g' /usr/local/etc/syslog-ng.conf && service syslog-ng restart​

Since then we've been receiving syslog messages fine via TCP.
So you didn't need to set-up a jail at all Chris?
 

mrad

Cadet
Joined
May 8, 2017
Messages
1
Hello, Maybe a bt old and offtopic but does anybody know how to ad a second Sysloghost as a Target in the webgui?
 

Sakuru

Guru
Joined
Nov 20, 2015
Messages
527
Try separating the entries with commas.
 
Status
Not open for further replies.
Top