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

If I have a line in a login script that I want to output to a syslog server, how can I do that?
Who is Participating?
QlemoConnect With a Mentor Batchelor and DeveloperCommented:
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
) | %LOGONSEVER%\NetLogon\logger -l mysyslogserver.address

Open in new window

Delphineous SilverwingGood Ol' GeekCommented:
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 -
David Johnson, CD, MVPOwnerCommented:
rem this is my login.bat
do this
do that
do this thing >> \\servername\share\logsgohere\lookatme.txt
rem end of script
Robberbaron (robr)Commented:
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
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

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.