Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
syslog-ng mysql
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German)
View previous topic :: View next topic  
Author Message
maes
n00b
n00b


Joined: 20 Aug 2015
Posts: 3

PostPosted: Thu Aug 20, 2015 2:37 pm    Post subject: syslog-ng mysql Reply with quote

Hallo zusammen,

ich habe einen syslog-ng Server in Betrieb genommen und möchte die Logeinträge nach MySQL übertragen. Leider wird nur der erste Log Eintrag übertragen und danach keine weiteren mehr!

Meine Konfig:

Code:
destination d_mysql {
program(“/usr/bin/mysql –user=root –password=xxx syslog_ng”
template(“INSERT INTO syslog_ng (host, facility, priority, level, tag, datetime, program, msg) VALUES ( ‘$HOST’, ‘$FACILITY’, ‘$PRIORITY’, ‘$LEVEL’, ‘$TAG’, ‘$YEAR-$MONTH-$DAY $HOUR:$MIN:$SEC’,’$PROGRAM’, ‘$MSG’ );\n”)
template-escape(yes));};

destination messages { file(“/var/lib/mysql/messages”); };
log { source(s_src);destination(messages); destination(d_mysql);};



Ich hoffe es kann mir wer weiterhelfen. Vielen Dank!
Back to top
View user's profile Send private message
forrestfunk81
Guru
Guru


Joined: 07 Feb 2006
Posts: 565
Location: münchen.de

PostPosted: Thu Aug 20, 2015 5:26 pm    Post subject: Reply with quote

Hallo maes,

bei mir funktioniert mysql logging mit folgender Konfiguration:
Code:
source src { system(); internal(); };

filter f_no_debug { not level(debug); };

destination mysql { sql(type(mysql) username("DB_USER") password("STRENG_GEHEIM") database("syslog") host("localhost") table("logs") columns("host", "facility", "priority", "level", "tag", "datetime", "program", "msg") values("$HOST", "$FACILITY", "$PRIORITY", "$LEVEL", "$TAG","$YEAR-$MONTH-$DAY $HOUR:$MIN:$SEC","$PROGRAM", "$MSG") indexes("datetime", "host", "program", "pid", "message") ); };

log { source(src); filter(f_no_debug); destination(mysql); };


IIRC muss man syslog-ng dafür mit "dbi" USE Flag bauen.
_________________
# cd /pub/
# more beer
Back to top
View user's profile Send private message
maes
n00b
n00b


Joined: 20 Aug 2015
Posts: 3

PostPosted: Fri Aug 21, 2015 7:21 am    Post subject: Reply with quote

Vielen Dank. Das funktioniert bei mir auch.

Leider wird immer nur der erste Eintrag nach SQL geschrieben. Danach keine weiteren mehr. Lösche ich den ersten Eintrag in der DB, und erzeuge einen neuen Log Eintrag, wird dieser wieder als einziges in die DB geschrieben.
Hat dazu noch einer eine Idee?
Back to top
View user's profile Send private message
forrestfunk81
Guru
Guru


Joined: 07 Feb 2006
Posts: 565
Location: münchen.de

PostPosted: Fri Aug 21, 2015 8:27 am    Post subject: Reply with quote

Hmm...
Wie ist denn die Definition der DB Tabelle bei dir? Es könnte z.B. der Primärschlüssel nicht passen.
_________________
# cd /pub/
# more beer
Back to top
View user's profile Send private message
maes
n00b
n00b


Joined: 20 Aug 2015
Posts: 3

PostPosted: Fri Aug 21, 2015 8:39 am    Post subject: Reply with quote

Siehe Bild. seq ist der Primärschlüssel. Wie in diesem Beitrag beschrieben http://anton.dollmaier.name/2013/05/10/syslog-host-mit-syslog-ng-und-mysql/

http://www.pic-upload.de/view-28074593/2015-08-21_10-30-20.png.html
Back to top
View user's profile Send private message
Jean-Paul
Guru
Guru


Joined: 13 Apr 2009
Posts: 307

PostPosted: Fri Aug 21, 2015 6:06 pm    Post subject: Reply with quote

Nur als Anregung. Hast du den Artikel auch gelesen?
http://blog.jonaspasche.com/2011/08/17/syslog-ng-und-mysql/
_________________
”Everything should be made as simple as possible, but no simpler.” – Albert Einstein
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum