Solved

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

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

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 69

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Separate DNS forwarding 2 47
Can’t disable NAT protocol in Windows Server 2012 3 88
Simple Fibre Question 6 38
Measure time after installing Antivirus 8 61
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.
The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
This tutorial will walk an individual through configuring a drive on a Windows Server 2008 to perform shadow copies in order to quickly recover deleted files and folders. Click on Start and then select Computer to view the available drives on the se…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…

730 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