LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 11-21-2009, 08:15 AM   #1
karmacop81
LQ Newbie
 
Registered: Nov 2009
Posts: 2

Rep: Reputation: 0
Post Piping NC output to Logger for syslog


Hey guys.

Im working on a way to pipe the output of a telnet session in to the logger command.
Basically the system I'm working on (an IP PBX) has a call logging functionality. This works by presenting the data via a telnet connection. For example, I would telnet to the device, it doesnt echo anything on the console but it quietly prompts for a password (which is blank) so all u do is simply press enter and wait... Once a call hangup happens, the call detail pops up in the telnet console.

What we want to do is, rather than having to make a connection into the system like this, is to get the system to send the call logs out via syslog (as many other phone system do). To do this I thought about creating a script that runs locally on the PBX that keeps a telnet session open to 127.0.0.1 and then pipes the output to logger which then has the syslog send it out to our central syslogging box.

Using something like 'nc 127.0.0.1 port | logger -T CDR' seems to do what i want, except that it doesnt send the carriage return needed to authenticate the telnet session via the blank password as explained above. I've tried using like 'echo -e "\rn" | nc 127.0.0.1 port | logger -T CDR' which (i think works) but once i run the command it doesnt keep the netcat session open, it just runs and exits.

Does anyone have any ideas as to how I can make this work?

Things to bear in mind. The PBX is a linux based appliance, it uses busybox instead of the standard tools, so alot of the commands dont have all of their features, secondly its not straight forward to install additional tools onto the system.

Regards

Last edited by karmacop81; 11-21-2009 at 05:39 PM.
 
Old 11-22-2009, 08:20 PM   #2
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Etch/Lenny/Squeeze
Posts: 3,340

Rep: Reputation: 286Reputation: 286Reputation: 286
I would use Expect to open a Telnet connection. I hope you can install expect (a TCL dialect). But you could run Expect on another host as well.

jlinkels
 
Old 11-23-2009, 04:52 AM   #3
karmacop81
LQ Newbie
 
Registered: Nov 2009
Posts: 2

Original Poster
Rep: Reputation: 0
Hey jlinkels

Thanks for your reply, unfortunately the system does not have TCL installed by default, I had a quick go at installing it and it fails, so I think expect is going to be a no go...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Piping output between processes. C. banan Programming 1 11-13-2006 12:25 AM
syslog: using logger (please help test this) psychobyte Linux - Security 1 01-07-2005 07:26 PM
Syslog logger facility problem tuxster Suse/Novell 0 01-02-2005 05:17 PM
Syslog logger facility problem tuxster Linux - General 0 12-25-2004 01:29 PM
system logger fails when restarting syslog tpau Linux - General 1 10-21-2003 09:40 PM


All times are GMT -5. The time now is 01:14 PM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration