I use this:
>gcc -o syslog_write syslog_writer.c
>./syslog_writer 300 <-- This is the number of messages it will write
#include <stdlib.h>
#include <syslog.h>
#include <stdio.h>
int main(int argc, char **argv) {
int num_syslogs = atoi(argv[1]), i;
openlog("syslog_writer", LOG_CONS | LOG_PID, LOG_LOCAL1);
for(i=0; i < num_syslogs; i++) {
syslog(LOG_NOTICE, "syslog_writer: log number %d", i);
}
return(1);
}
-----Original Message-----
From: rsyslog-bounces@lists.adiscon.com
[mailto:rsyslog-bounces@lists.adiscon.com] On Behalf Of Jules Pagna
Disso
Sent: Tuesday, January 20, 2009 1:15 PM
To: rsyslog-users
Subject: Re: [rsyslog] client
hi there,
thanks for the answer it helped and does what I wanted. Now, I am wonder
if
there is a sample code how to send log file from a c/c++ code to syslog
deamon.
thanks
Jules
2009/1/19 Patrick Shen <patrick.shen@net-m.de>
> Jules Pagna Disso wrote:
> > hi there,
> >
> > Is there an example of client sending alert to syslog?
> >
> > is it possible to create and send an alert from the command prompt
to
> > syslog?
> >
> > thanks,
> > Jules
>
> Do you mean 'logger' ?
>
> Try 'man logger'.
>
> Best regards,
> Patrick
>
> _______________________________________________
> rsyslog mailing list
> http://lists.adiscon.net/mailman/listinfo/rsyslog
> http://www.rsyslog.com
>
_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog http://www.rsyslog.com Confidentiality Notice: This e-mail message (including any attached or
embedded documents) is intended for the exclusive and confidential use of the
individual or entity to which this message is addressed, and unless otherwise
expressly indicated, is confidential and privileged information of Rackspace.
Any dissemination, distribution or copying of the enclosed material is prohibited.
If you receive this transmission in error, please notify us immediately by e-mail
at abuse@rackspace.com, and delete the original message.
Your cooperation is appreciated.
_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog http://www.rsyslog.com