Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
07-02-2012, 12:36 PM
|
#1
|
Member
Registered: Apr 2011
Posts: 51
Rep:
|
Simple TCP/IP receiver
Hi,
I'm looking for a simple tool or way to receive and log a text stream (log file) send by a client (squid) on a TCP port.
The TCP server would need to be launched automatically at boot.
I also need to be able to rotate the generated log file using logrotate.
Anybody could point me to a solution ? FYI The server is a Debian.
Thanks
Matt
Last edited by mgai7755; 07-02-2012 at 12:49 PM.
|
|
|
07-02-2012, 01:00 PM
|
#2
|
LQ Guru
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 27,188
|
Quote:
Originally Posted by mgai7755
Hi,
I'm looking for a simple tool or way to receive and log a text stream (log file) send by a client (squid) on a TCP port.
The TCP server would need to be launched automatically at boot. I also need to be able to rotate the generated log file using logrotate. Anybody could point me to a solution ? FYI The server is a Debian.
|
Read about the access_log directive for squid:
http://www.squid-cache.org/Doc/config/access_log/
Set it to be "syslog"; anything logged to the squid logs will then be sent to your syslog server. Since you can send your syslog events to a REMOTE syslog server (preferably running syslog-ng, so you can separate things into different files for different servers), that will mean your squid events will go to a remote syslog server into a file. From there, set up logrotate to perform how you wish. Syslog servers should normally be started at boot time.
|
|
|
07-02-2012, 03:39 PM
|
#3
|
LQ Newbie
Registered: Jul 2012
Distribution: Ubuntu 12.10, Back | Track 5
Posts: 2
Rep:
|
Netcat
Hi there, have you checked out NetCat yet? It;s known as the TCP/IP swiss army knife
|
|
1 members found this post helpful.
|
07-03-2012, 03:56 AM
|
#4
|
Member
Registered: Apr 2011
Posts: 51
Original Poster
Rep:
|
Quote:
Originally Posted by TB0ne
Read about the access_log directive for squid:
http://www.squid-cache.org/Doc/config/access_log/
Set it to be "syslog"; anything logged to the squid logs will then be sent to your syslog server. Since you can send your syslog events to a REMOTE syslog server (preferably running syslog-ng, so you can separate things into different files for different servers), that will mean your squid events will go to a remote syslog server into a file. From there, set up logrotate to perform how you wish. Syslog servers should normally be started at boot time.
|
Thanks TB0ne. I'm aware of this possibility and managed to get it work. However, there are multiple difficulties linked to this way of doing it :
- PfSense's syslog server doesn't support sending messages over a TCP link. UDP isn't reliable enough in this case.
- My file server is coming with an old rsyslog server which doesn't implement a way to send the remote messages in a particular file, meaning squid's messages are sent to the syslog.log file together with local events.
- And last but not least, I think my version of rsyslog doesn't support the template system that is needed to remove the timestamps normally added before each message received. That means that a squid log analyzer would be unable to handle the log file.
Therefore, I thought is was easier and more reliable to use squid's ability to send the logs through a simple TCP link.
Last edited by mgai7755; 07-03-2012 at 03:58 AM.
|
|
|
07-03-2012, 06:43 AM
|
#5
|
Member
Registered: Apr 2011
Posts: 51
Original Poster
Rep:
|
Quote:
Originally Posted by zwcbz
Hi there, have you checked out NetCat yet? It;s known as the TCP/IP swiss army knife
|
That's indeed a good direction ! I succeeded testing with nc -l -p 1698 > pfsense.log to open port 1698 to listen.
Two questions :
* I noticed the process quit when the connexion is closed from the client side. Is there a way to keep the server from closing ?
* I'm not so good at Linux... How can I add safely and reliably to the startup items ? (Automatic start at boot and restart in case of failure)
Thanks
Matt
|
|
|
All times are GMT -5. The time now is 02:41 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|