View previous topic :: View next topic |
Author |
Message |
maes n00b
Joined: 20 Aug 2015 Posts: 3
|
Posted: Thu Aug 20, 2015 2:37 pm Post subject: syslog-ng mysql |
|
|
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 |
|
|
forrestfunk81 Guru
Joined: 07 Feb 2006 Posts: 565 Location: münchen.de
|
Posted: Thu Aug 20, 2015 5:26 pm Post subject: |
|
|
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 |
|
|
maes n00b
Joined: 20 Aug 2015 Posts: 3
|
Posted: Fri Aug 21, 2015 7:21 am Post subject: |
|
|
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 |
|
|
forrestfunk81 Guru
Joined: 07 Feb 2006 Posts: 565 Location: münchen.de
|
Posted: Fri Aug 21, 2015 8:27 am Post subject: |
|
|
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 |
|
|
maes n00b
Joined: 20 Aug 2015 Posts: 3
|
|
Back to top |
|
|
Jean-Paul Guru
Joined: 13 Apr 2009 Posts: 307
|
|
Back to top |
|
|
|
|
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
|
|