Solved

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

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

On July 14th 2015, Windows Server 2003 will become End of Support, leaving hundreds of thousands of servers around the world that still run this 12 year old operating system vulnerable and potentially out of compliance in many organisations around t…
Learn about cloud computing and its benefits for small business owners.
This tutorial will give a an overview on how to deploy remote agents in Backup Exec 2012 to new servers. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as connecting to a remote Back…
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…

708 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

12 Experts available now in Live!

Get 1:1 Help Now