Solved

How do I redirect the output of a batch file line to a syslog such as Kiwi?

Posted on 2011-09-29
4
660 Views
Last Modified: 2013-04-05
If I have a line in a login script that I want to output to a syslog server, how can I do that?
0
Comment
Question by:probetech
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 19

Expert Comment

by:Delphineous Silverwing
ID: 36891334
This is not something that can be natively done from Windows, however a third-party tool can do the trick.

Logger is a free command-line tool - http://www.monitorware.com/en/logger/index.php
0
 
LVL 81

Expert Comment

by:David Johnson, CD, MVP
ID: 36892095
rem this is my login.bat
do this
do that
do this thing >> \\servername\share\logsgohere\lookatme.txt
rem end of script
0
 
LVL 32

Expert Comment

by:Robberbaron (robr)
ID: 36894931
you need a combination of logger (as noted by Delphineous) and the output redirection ve3ofa shows.  

The method ve3ofa is the 'poor-mans' logging direct to a shared textfile, which i use extensively.  need to add info about who is adding to the logfile.

for syslog...
in the case of a login script, it would be best to place the logger.exe file on the sysvol share,
  eg \\myserver\NETLOGON   so that it is always available at startup.

 this can also be shown as %LOGONSEVER%\NETLOGON in a batch file to make it use the 'nearest' available domain server.


rem this is my login.bat
do_this
do_that
rem echo next command output to Syslog server
do_this_command >> %LOGONSEVER%\NetLogon\logger -l mysyslogserver.address
rem end of script

Open in new window

0
 
LVL 70

Accepted Solution

by:
Qlemo earned 500 total points
ID: 36908805
Almost. Replace >> with a | (pipe), and it should work. If you need more than one command to produce the syslog output:
rem All commands in parens are logged as a single entry
( do_this
  do_that
  do_this_command
) | %LOGONSEVER%\NetLogon\logger -l mysyslogserver.address

Open in new window

0

Featured Post

Save the day with this special offer from ATEN!

Save 30% on the CV211 using promo code EXPERTS30 now through April 30th. The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

OfficeMate Freezes on login or does not load after login credentials are input.
This article explains how to install and use the NTBackup utility that comes with Windows Server.
This tutorial will walk an individual through the steps necessary to enable the VMware\Hyper-V licensed feature of Backup Exec 2012. In addition, how to add a VMware server and configure a backup job. The first step is to acquire the necessary licen…
This tutorial will walk an individual through the steps necessary to install and configure the Windows Server Backup Utility. Directly connect an external storage device such as a USB drive, or CD\DVD burner: If the device is a USB drive, ensure i…

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question