LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 10-07-2013, 02:40 AM   #1
austinium
Member
 
Registered: Nov 2007
Location: India
Distribution: Debian Stable, Debian Testing
Posts: 219

Rep: Reputation: 27
trouble with remote logging using syslog-ng


I am having trouble setting up remote logging...

I have added the following to the existing syslog-ng.conf file in the client that runs Ubuntu 13.04.

Code:
destination d_logServer {udp("syslog server's IP" port(514));};

log { source(s_src); destination(d_logServer); };
I have added the following to the syslog-ng server's (Debian) syslog-ng.conf file:
Code:
source s_netU { udp(ip("syslog server's IP")port(514)); };

destination d_remote { file("/var/log/HOSTS/$HOST.$YEAR.$MONTH.$DAY"); };

filter f_remote { host( "syslog client's IP" ); };

log { source(s_netU); filter(f_remote); destination(d_remote); };
The server is not receiving the logs, local logging on the client is working fine. Help!

Last edited by austinium; 10-07-2013 at 02:43 AM.
 
Old 10-07-2013, 03:21 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
is the issue on the client or the server? does a tcpdump show the traffic leaving the box? (tcpdump -vn port 514 -i eth0)
 
1 members found this post helpful.
Old 10-07-2013, 04:53 AM   #3
austinium
Member
 
Registered: Nov 2007
Location: India
Distribution: Debian Stable, Debian Testing
Posts: 219

Original Poster
Rep: Reputation: 27
Thank you replying

I ran the command at the client. From the output of the command below it looks like messages are leaving the client?
Code:
# tcpdump -vn port 514 -i eth0
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
15:17:22.644226 IP (tos 0x0, ttl 64, id 12474, offset 0, flags [DF], proto UDP (17), length 127)
    SyslogClient's_IP.33079 > SyslogServer's_IP.514: SYSLOG, length: 99
	Facility kernel (0), Severity info (6)
	Msg: Oct  7 15:17:22 syslogclient kernel: [13274.558125] device eth0 entered promiscuous mode\0x0a
I already have a router sending it's syslog to the server, and the router's logs are arriving fine. Running the above command on the server shows the log lines from the router.

 
Old 10-07-2013, 05:46 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
ok so is it reaching the server?
 
Old 10-07-2013, 06:27 AM   #5
austinium
Member
 
Registered: Nov 2007
Location: India
Distribution: Debian Stable, Debian Testing
Posts: 219

Original Poster
Rep: Reputation: 27
hi Chris,

I redirected tcpdump's output to a file, did some grep-ing, turns out the client is sending the log lines to the server. However log lines are not being written to file.

I believe this is the line responsible for writing to file:
Code:
destination d_remote { file("/var/log/HOSTS/$HOST.$YEAR.$MONTH.$DAY"); };
Am i missing something here?
 
Old 10-07-2013, 06:31 AM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
looks fine offhand, run the serve rin foreground mode and see what it says.

looking at the manpage "syslog-ng -Fedv" looks like the chap, but some of those options might clash. I'd also add any command line parameters already in use, so run "ps -ef | grep syslog-ng" to see how it's currently being run and modify accordingly. Stop the service first of course.
 
1 members found this post helpful.
Old 10-07-2013, 07:14 AM   #7
austinium
Member
 
Registered: Nov 2007
Location: India
Distribution: Debian Stable, Debian Testing
Posts: 219

Original Poster
Rep: Reputation: 27
i ran "ps -ef | grep syslog-ng", syslog-ng is running without any arguments.
i ran syslog-ng -Fedv > ~/test.txt 2>&1 ... then logged into the syslog client via ssh, just to generate some logs. tcpdump would have captured logs being generated in such cases as it did earlier in the day. However, nothing shows up in the output of syslog-ng being run in the foreground.

Is is possible that syslog-ng may be dropping logs without processing them...or is it that i am too tired

Do let me know what you think...if theres something else i should try.

thanks
 
Old 10-07-2013, 07:21 AM   #8
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
No, it'd be logging the fact that it's received them from somewhere, even if it does drop them on the floor. If you're succesfully logging from the router already though, you should be able to see those logs in the debug trail. So if those router logs aren't visible in the debug either, something is going wrong in the debug commands themselves.
 
Old 10-07-2013, 10:42 AM   #9
voleg
Member
 
Registered: Oct 2013
Distribution: RedHat CentOS Fedora SuSE
Posts: 354

Rep: Reputation: 51
Remove "filter" for debugging. The message, probably, does not include IP, but hostname.
 
1 members found this post helpful.
Old 10-09-2013, 12:02 PM   #10
austinium
Member
 
Registered: Nov 2007
Location: India
Distribution: Debian Stable, Debian Testing
Posts: 219

Original Poster
Rep: Reputation: 27
hi all,
sorry i haven't been able to post back. been caught up with other work.
havent been able to give time to this problem.

i have a doubt, the versions on syslog-ng running on the syslog server and the client are different, thouth only the minor numbers differ. It shouldn't make any difference, right?

@voleg: I will surely try out the configuration without the filter, but the same setup works for the Router. I am able to see the logs from the router being written properly to file. Any clue why it would be different in the case of a Linux machine?

thank you Chris and voleg...
 
Old 10-10-2013, 03:24 AM   #11
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
It's not that it shouldn't make any difference, it's not allowed to make a difference. They are talking syslog. a standard protocol, they aren't allowed to have anything software / version specific anywhere in the interaction, otherwise it wouldn't be standard syslog traffic anymore.
 
Old 10-11-2013, 12:34 AM   #12
austinium
Member
 
Registered: Nov 2007
Location: India
Distribution: Debian Stable, Debian Testing
Posts: 219

Original Poster
Rep: Reputation: 27
When logging from Linux Servers syslog uses the machine's hostname and not the IP address as in the case of devices such as routers. Replacing the IP address of the server with it's hostname fixed the issue.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[syslog-ng] logging remote server by IP address noir911 Linux - Server 4 06-22-2018 08:01 AM
[SOLVED] remote logging problem with syslog utility shri_22ram Linux - General 2 01-23-2013 05:29 AM
[SOLVED] syslog remote logging with rsyslog server Chenchu Linux - Newbie 3 09-17-2011 01:34 PM
syslog-ng trying for remote logging sir-lancealot Linux - Server 0 06-26-2009 11:03 AM
SYSLOG - logging to Remote Host dvong3 Linux - Networking 4 09-24-2002 07:14 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 12:12 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration