Solved

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

Posted on 2011-09-29
4
591 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
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 78

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 68

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

AWS has developed and created its highly available global infrastructure allowing users to deploy and manage their estates all across the world through the use of the following geographical components   RegionsAvailability ZonesEdge Locations  Wh…
Data center, now-a-days, is referred as the home of all the advanced technologies. In-fact, most of the businesses are now establishing their entire organizational structure around the IT capabilities.
This tutorial will walk an individual through locating and launching the BEUtility application and how to execute it on the appropriate database. Log onto the server running the Backup Exec database. In a larger environment, this would generally be …
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…

910 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now