X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=blobdiff_plain;ds=sidebyside;f=src%2Fanalysisd%2Falerts%2Flog.c;h=4095b616ebff7b7f9712bd9136261e5d7017481c;hb=301048b51990573e58a30dc4a5bb4ec285cad554;hp=2686620b46cba320cbc4c38e53c87d6bc9ba1038;hpb=914feba5d54f979cd5d7e69c349c3d01f630042a;p=ossec-hids.git diff --git a/src/analysisd/alerts/log.c b/src/analysisd/alerts/log.c index 2686620..4095b61 100755 --- a/src/analysisd/alerts/log.c +++ b/src/analysisd/alerts/log.c @@ -1,11 +1,11 @@ -/* @(#) $Id: log.c,v 1.33 2009/11/20 15:38:28 dcid Exp $ */ +/* @(#) $Id$ */ /* Copyright (C) 2009 Trend Micro Inc. * All right reserved. * * This program is a free software; you can redistribute it * and/or modify it under the terms of the GNU General Public - * License (version 3) as published by the FSF - Free Software + * License (version 2) as published by the FSF - Free Software * Foundation */ @@ -48,6 +48,52 @@ void OS_Store(Eventinfo *lf) } + +void OS_LogOutput(Eventinfo *lf) +{ + printf( + "** Alert %d.%ld:%s - %s\n" + "%d %s %02d %s %s%s%s\nRule: %d (level %d) -> '%s'\n" + "Src IP: %s\nUser: %s\n%.1256s\n", + lf->time, + __crt_ftell, + lf->generated_rule->alert_opts & DO_MAILALERT?" mail ":"", + lf->generated_rule->group, + lf->year, + lf->mon, + lf->day, + lf->hour, + lf->hostname != lf->location?lf->hostname:"", + lf->hostname != lf->location?"->":"", + lf->location, + lf->generated_rule->sigid, + lf->generated_rule->level, + lf->generated_rule->comment, + lf->srcip == NULL?"(none)":lf->srcip, + lf->dstuser == NULL?"(none)":lf->dstuser, + lf->full_log); + + + /* Printing the last events if present */ + if(lf->generated_rule->last_events) + { + char **lasts = lf->generated_rule->last_events; + while(*lasts) + { + printf("%.1256s\n",*lasts); + lasts++; + } + lf->generated_rule->last_events[0] = NULL; + } + + printf("\n"); + + fflush(stdout); + return; +} + + + /* OS_Log: v0.3, 2006/03/04 */ /* _writefile: v0.2, 2005/02/09 */ void OS_Log(Eventinfo *lf)