MySQL connection - Only works with default port

This is the place for you, if you got rsyslog up and running but wonder how to make it do what you want.

Moderator: rgerhards

MySQL connection - Only works with default port

Postby lperr on Tue Aug 12, 2008 12:35 am

Hi,
I'm using v 3.18.2 and if I use a sample rule like this:

*.* :ommysql:127.0.0.1,database,user,password;template

everything works if I have MySQL listening on the default port 3306.
But if I have it listen on 1234, RSyslog doesn't connect with something like:

*.* :ommysql:127.0.0.1:1234,database,user,password;template

Am I using a wrong syntax? I always like to change the default ports when possible so this feature would come in handy if it isn't implemented yet.

One more thing, it seems to me that the directive
$MainMsgQueueWorkerTimeoutThreadShutdown
isn't yet available on the version I'm using.
Can anybody confirm this?

MODERATOR EDIT: turned off smilies for better readibility
lperr
Advanced
 
Posts: 26
Joined: Wed Aug 06, 2008 12:00 pm

Professional Services Information

  • Custom written rsyslog.conf?
  • Maintenance Contract?
  • Installation support?

Re: MySQL connection - Only works with default port

Postby prakash.akumalla on Tue Aug 12, 2008 5:35 am

hi,
You should check whether the port you have assigned is free or not I think.

Prakash.
prakash.akumalla
Frequent Poster
 
Posts: 101
Joined: Thu Jun 26, 2008 2:37 pm

Re: MySQL connection - Only works with default port

Postby rgerhards on Tue Aug 12, 2008 6:56 am

lperr wrote:One more thing, it seems to me that the directive
$MainMsgQueueWorkerTimeoutThreadShutdown
isn't yet available on the version I'm using.
Can anybody confirm this?


No, this is available. Please post why you think it isn't - maybe there is a bug...

Rainer
User avatar
rgerhards
Site Admin
 
Posts: 1780
Joined: Thu Feb 13, 2003 11:57 am

Re: MySQL connection - Only works with default port

Postby lperr on Tue Aug 12, 2008 8:03 am

You should check whether the port you have assigned is free


I'm afraid that's not the problem here. I've just double-checked that
Code: Select all
*.* :ommysql:127.0.0.1,database,user,password;template

works, while
Code: Select all
*.* :ommysql:127.0.0.1:3306,database,user,password;template

does not.

The port is the same. They should both work, but the latter doesn't.

No, this is available.

I thought that I was getting an error about this line when RSyslog was starting.
After I've sorted out the database connection issue I'll look more carefully into this and let you know.

For now I'm going to try the last development (and eventually beta) version, hoping to solve the database issue.
If this might be of any help I'm compiling RSyslog from source on a up to date Debian stable installation.
lperr
Advanced
 
Posts: 26
Joined: Wed Aug 06, 2008 12:00 pm

Re: MySQL connection - Only works with default port

Postby rgerhards on Tue Aug 12, 2008 8:06 am

On the port: rsyslog does not do anything specific to set the MySQL port. It just passes the string you give add:port to the MySQL connect function. I am not sure if that function handles ports correctly. In any case, I'll check if rsyslog picks the right string...

Do you see any MySQL error message in your syslog logs during startup (see http://www.rsyslog.com/doc-troubleshoot.html)?
User avatar
rgerhards
Site Admin
 
Posts: 1780
Joined: Thu Feb 13, 2003 11:57 am

Re: MySQL connection - Only works with default port

Postby prakash.akumalla on Tue Aug 12, 2008 9:15 am

hi,
Is the ip-address you used there is that of the local system or the remote system(server) to which you are willing to send the data?
If that is the local system, I don't think that there will be any need to give the port number.
If this is the remote system then use that port you want to use here to TCP or UDP with which you are willing to transfer the date to the remote system(server)

If this is not at all the problem post your problem clearly. :)

cheers,
Prakash.
prakash.akumalla
Frequent Poster
 
Posts: 101
Joined: Thu Jun 26, 2008 2:37 pm

Re: MySQL connection - Only works with default port

Postby lperr on Tue Aug 12, 2008 9:18 am

Do you see any MySQL error message in your syslog logs during startup (see http://www.rsyslog.com/doc-troubleshoot.html)?


The following happens with 3.21.2.
I'm only using the -c3 switch.

Port issue

If I do check for configuration problems with the -N1 everything seems fine.

Better luck with the debug log.
I've not bothering checking it in its entirety (even if it's a manageable 71K) since I get this on the console that should be quite indicative:
Code: Select all
rsyslogd: db error (2005): Unknown MySQL server host '127.0.0.1:3306' (3)


Directive issue

If I use this directive
Code: Select all
$MainMsgQueueWorkerTimeoutThreadShutdown 10000


when checking with -N1 I get

Code: Select all
rsyslogd: invalid or yet-unknown config file command - have you forgotten to load a module? [try http://www.rsyslog.com/e/3003 ]
rsyslogd: the last error occured in /etc/rsyslog.conf, line 79


Let me know if I should pastebin my configuration file and/or debug log.
lperr
Advanced
 
Posts: 26
Joined: Wed Aug 06, 2008 12:00 pm

Re: MySQL connection - Only works with default port

Postby rgerhards on Tue Aug 12, 2008 9:26 am

lperr wrote:Better luck with the debug log.
I've not bothering checking it in its entirety (even if it's a manageable 71K) since I get this on the console that should be quite indicative:
Code: Select all
rsyslogd: db error (2005): Unknown MySQL server host '127.0.0.1:3306' (3)



OK, that means MySQL does not support that syntax. I'll have a look into that issue, but it probably boils down to an enhancement request for ommyql, where it needs to pass the port number in a MySQL-specific way.

Info on the directive shortly.
User avatar
rgerhards
Site Admin
 
Posts: 1780
Joined: Thu Feb 13, 2003 11:57 am

Re: MySQL connection - Only works with default port

Postby rgerhards on Tue Aug 12, 2008 9:40 am

OK, I can confirm the port number. This needs to go into a separate parameter. I think I can quickly integrate an enhancement, but I will use a somewhat different syntax (else I get into potential trouble with IPv6 addresses again... ;)).

Stay tuned...
User avatar
rgerhards
Site Admin
 
Posts: 1780
Joined: Thu Feb 13, 2003 11:57 am

Re: MySQL connection - Only works with default port

Postby rgerhards on Tue Aug 12, 2008 9:44 am

lperr wrote:One more thing, it seems to me that the directive
$MainMsgQueueWorkerTimeoutThreadShutdown
isn't yet available on the version I'm using.
Can anybody confirm this?


oops... There is a typo in the source. The directive actually right now is

$MainMsgQueueWorkeTimeoutrThreadShutdown

... obviously incorrect ;) I'll fix this in all affected (and supported) builds. As a work-around, you can use the misspelled directive name, but that will turn into a syntax error once the new versions are out.

Thanks for pointing this out.

Rainer
User avatar
rgerhards
Site Admin
 
Posts: 1780
Joined: Thu Feb 13, 2003 11:57 am

Re: MySQL connection - Only works with default port

Postby lperr on Tue Aug 12, 2008 9:52 am

Thanks for the quick turnaround, I'll be keeping an eye out for new releases then.

Regards,
-Luigi
lperr
Advanced
 
Posts: 26
Joined: Wed Aug 06, 2008 12:00 pm

Re: MySQL connection - Only works with default port

Postby rgerhards on Tue Aug 12, 2008 9:56 am

This is the patch for the config directive (for v3-stable):

http://git.adiscon.com/?p=rsyslog.git;a ... fb35638879

Side-Note: would you be willing to test - from source - the MySQL port enhancement? That would save me a lot of time as I otherwise would need to setup such a MySQL environment (and this not being very MySQL-literate...).

Rainer
User avatar
rgerhards
Site Admin
 
Posts: 1780
Joined: Thu Feb 13, 2003 11:57 am

Re: MySQL connection - Only works with default port

Postby rgerhards on Tue Aug 12, 2008 10:13 am

OK, not waiting for you reply but hoping you'll be available for testing: I now enhanced ommysql. This tarball has both the fix and the enhancement:

http://download.rsyslog.com/rsyslog/rsy ... st3.tar.gz

I'd appreciate if you could give it a try and report back.

Note that I did the enhancement to the v3-stable branch, because it thankfully involves very little code change (if it actually works ;)). This tarball is NOT necessarily the official 3.18.3 release.

Feedback is much appreciated - as I already said, it would save me a lot of time and lead to a quicker official release ;)

Looking forward to it,
Rainer
User avatar
rgerhards
Site Admin
 
Posts: 1780
Joined: Thu Feb 13, 2003 11:57 am

Re: MySQL connection - Only works with default port

Postby lperr on Tue Aug 12, 2008 11:56 am

I can confirm that now everything works as the ChangeLog specifies. Thank you very much.

I noticed another strange behaviour though.

I'm making use of the Text File Input Module, it correctly stores the files' contents into the database but according to the documentation it should keep track of already logged lines.
If the files change during "normal" execution everything works, RSyslog logs only new lines.

But when I reboot the machine (or just restart RSyslog) all the lines get logged again from the beginning of the file, while I was expecting RSyslog to log only the new lines.

I noticed that the location I specify in $WorkDirectory remains always empty, maybe this is the cause of this behaviour.
However this shouldn't be a permissions issue since RSyslog is running as root.
Just in case I also set $WorkDirectory before the File Input directives but this doesn't make a difference.
Just like using an absolute path in $InputFileStateFile instead of just the filename.

Any suggestions?
lperr
Advanced
 
Posts: 26
Joined: Wed Aug 06, 2008 12:00 pm

Re: MySQL connection - Only works with default port

Postby rgerhards on Tue Aug 12, 2008 12:54 pm

Glad to hear it works. For the imfile issue - could you please create a separate topic, as things otherwise get to much mixed up :)
User avatar
rgerhards
Site Admin
 
Posts: 1780
Joined: Thu Feb 13, 2003 11:57 am

Google Ads



Return to Configuration

Who is online

Users browsing this forum: No registered users and 0 guests

cron