HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- How to redirect "telnet log" to a separate file
Operating System - HP-UX
1827802
Members
2274
Online
109969
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-01-2008 05:52 AM
01-01-2008 05:52 AM
Dear all,
Could you help me to redirect logs about telnet to a separate file.
I have checked /etc/syslog.conf.But I found few information about "facility".
as you know we can redirect "ftp log" to a different file by "local5.info /var/adm/ftp.log "
How can I do for telnet log?
Thanks a lot and wish you all a good new year.
Louis
Could you help me to redirect logs about telnet to a separate file.
I have checked /etc/syslog.conf.But I found few information about "facility".
as you know we can redirect "ftp log" to a different file by "local5.info /var/adm/ftp.log "
How can I do for telnet log?
Thanks a lot and wish you all a good new year.
Louis
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-01-2008 07:24 AM
01-01-2008 07:24 AM
Solution
The best way to start researching this option is to look at the telnetd man page. All telnet connections are handled by the daemon telnetd and the man page has no reference to any log file at all -- thus, no unique telnet logging is available. So in order to log telnet connections, you have to turn on inetd logging. inetd is the parent of many network daemons including telnetd. You toggle inetd logging on or off with the inetd -l command. If inetd has logging turned on, you will see:
telnet/tcp: Connection from ...
in syslog.log (assuming that the info level has been enabled in /etc/syslog.conf). To turn on inetd logging when the system boots up, edit the file /etc/rc.config.d/netdaemons and change the INETD_ARGS line to read:
INETD_ARGS="-l"
Now all inetd-managed daemons will be logged to syslog.log (by default) using the facility daemon. That means that a telnet-specific log is not possible. All daemons managed by inetd will be logged with the daemon facility.
Now you can indeed move all inetd logging to another file. To do this, you modify /etc/syslog.conf to remove the daemon.* entries from syslog.log and add them to a new file, like this:
*.info;mail.none;daemon.none /var/adm/syslog/syslog.log
daemon.info /var/adm/syslog/daemon.log
The two lines are: log all facilities with messages starting at info level and higher, but do not log anything for mail and daemon facilities. The next line says: log all daemon messages at info and higher level.
You can create many different logfiles using the same technique. For instance, these entries will log ftp, auth and daemon in separate logs:
*.info;mail.none;local5.none;auth.none;daemon.none /var/adm/syslog/syslog.log
local5.info /var/adm/syslog/ftp.log
auth.info /var/adm/syslog/auth.log
daemon.info /var/adm/syslog/daemon.log
To determine the facility and level for a specific message in syslog, you need to to turn on syslogd facility/priority logging. To do this, add -v to syslogd's command line. To do this immediately:
# kill $(cat /var/run/syslog.pid)
# /usr/sbin/syslogd -v
and now all messages will have a 2-digit hex number inserted in front of the hostname, as in: 6D:myhost The hex digits are decoded using the information in the man page for syslog (man 3c syslog). To make this easier, I have attached a script that will decode any file (syslog.log by default) to display the facility and priority levels.
To make the syslog options permanent, edit the file /etc/rc.config.d/syslogd and change the line:
SYSLOGD_OPTS="-D -v"
Note that the -D option is recommended to force all console messages to syslog since most servers have no active console available.
Bill Hassell, sysadmin
telnet/tcp: Connection from ...
in syslog.log (assuming that the info level has been enabled in /etc/syslog.conf). To turn on inetd logging when the system boots up, edit the file /etc/rc.config.d/netdaemons and change the INETD_ARGS line to read:
INETD_ARGS="-l"
Now all inetd-managed daemons will be logged to syslog.log (by default) using the facility daemon. That means that a telnet-specific log is not possible. All daemons managed by inetd will be logged with the daemon facility.
Now you can indeed move all inetd logging to another file. To do this, you modify /etc/syslog.conf to remove the daemon.* entries from syslog.log and add them to a new file, like this:
*.info;mail.none;daemon.none /var/adm/syslog/syslog.log
daemon.info /var/adm/syslog/daemon.log
The two lines are: log all facilities with messages starting at info level and higher, but do not log anything for mail and daemon facilities. The next line says: log all daemon messages at info and higher level.
You can create many different logfiles using the same technique. For instance, these entries will log ftp, auth and daemon in separate logs:
*.info;mail.none;local5.none;auth.none;daemon.none /var/adm/syslog/syslog.log
local5.info /var/adm/syslog/ftp.log
auth.info /var/adm/syslog/auth.log
daemon.info /var/adm/syslog/daemon.log
To determine the facility and level for a specific message in syslog, you need to to turn on syslogd facility/priority logging. To do this, add -v to syslogd's command line. To do this immediately:
# kill $(cat /var/run/syslog.pid)
# /usr/sbin/syslogd -v
and now all messages will have a 2-digit hex number inserted in front of the hostname, as in: 6D:myhost The hex digits are decoded using the information in the man page for syslog (man 3c syslog). To make this easier, I have attached a script that will decode any file (syslog.log by default) to display the facility and priority levels.
To make the syslog options permanent, edit the file /etc/rc.config.d/syslogd and change the line:
SYSLOGD_OPTS="-D -v"
Note that the -D option is recommended to force all console messages to syslog since most servers have no active console available.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-01-2008 07:36 AM
01-01-2008 07:36 AM
Re: How to redirect "telnet log" to a separate file
One additional note (worth a separate post):
/etc/syslog.conf has a VERY important format restriction: NO SPACES ALLOWED. The separator between logging information and the destination is one or more tabs -- no spaces allowed. To see this, type the command:
# cat -t /etc/syslog.conf
mail.debug^I^I/var/adm/syslog/mail.log
*.info;mail.none;local5.none;auth.none^I/var/adm/syslog/syslog.log
auth.info^I^I/var/adm/syslog/auth.log
local5.info^I^I/var/adm/syslog/ftp.log
*.alert^I^I^I/dev/console
*.alert^I^I^Iroot
*.emerg^I^I^I*
As you can see, there are ^I characters (^I means CTRL-I or the tab character) separating the two fields. Any line with spaces between fields or between directives will be silently ignored.
To test the syslog.conf file, use the command logger as in:
$ logger -p local5.warn "local5 (ftp) at warn level"
$ logger -p daemon.info "daemon at info level"
That will show where the message is logged and what the hex code looks like.
Bill Hassell, sysadmin
/etc/syslog.conf has a VERY important format restriction: NO SPACES ALLOWED. The separator between logging information and the destination is one or more tabs -- no spaces allowed. To see this, type the command:
# cat -t /etc/syslog.conf
mail.debug^I^I/var/adm/syslog/mail.log
*.info;mail.none;local5.none;auth.none^I/var/adm/syslog/syslog.log
auth.info^I^I/var/adm/syslog/auth.log
local5.info^I^I/var/adm/syslog/ftp.log
*.alert^I^I^I/dev/console
*.alert^I^I^Iroot
*.emerg^I^I^I*
As you can see, there are ^I characters (^I means CTRL-I or the tab character) separating the two fields. Any line with spaces between fields or between directives will be silently ignored.
To test the syslog.conf file, use the command logger as in:
$ logger -p local5.warn "local5 (ftp) at warn level"
$ logger -p daemon.info "daemon at info level"
That will show where the message is logged and what the hex code looks like.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-01-2008 07:44 AM
01-01-2008 07:44 AM
Re: How to redirect "telnet log" to a separate file
Dear Bill,
Thanks a lot for your kindly and detailed reply,I will try your suggestion.
Louis.
Thanks a lot for your kindly and detailed reply,I will try your suggestion.
Louis.
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Support
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP