LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 05-23-2021, 09:02 AM   #1
saeeddeep
LQ Newbie
 
Registered: May 2008
Posts: 11

Rep: Reputation: Disabled
rsyslog forwarding new messages only


hello

Configuring rsyslog on Centos 7 to forward logs to a centralized syslog server.

rsyslog forwards new log lines fine as expected. But the old existing lines in /var/log/messages are not forwarded. I see this is the normal behavior, only new lines will be forwarded.

Any way I can forward all existing lines from /var/log/messages ?
 
Old 05-23-2021, 09:47 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,638

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by saeeddeep View Post
hello
Configuring rsyslog on Centos 7 to forward logs to a centralized syslog server.

rsyslog forwards new log lines fine as expected. But the old existing lines in /var/log/messages are not forwarded. I see this is the normal behavior, only new lines will be forwarded. Any way I can forward all existing lines from /var/log/messages ?
Is there a reason you need those lines? If it's only about archiving purposes, you can just copy the file to the central syslog server and be done.

Alternatively, you can use either the logger command, or even something like:
Code:
cat <FILE NAME> | nc -4u -w1 <SYSLOG HOST> <SYSLOG PORT>
Have you searched for any solutions on your own? After thirteen years, you should know to do basic research first.
 
1 members found this post helpful.
Old 05-23-2021, 10:30 AM   #3
saeeddeep
LQ Newbie
 
Registered: May 2008
Posts: 11

Original Poster
Rep: Reputation: Disabled
yes, forwarding all content of /var/log/messages to rsyslog server is required.
cat file | nc .. before start forwarding logs solved this requirement. thanks TB0ne
 
Old 05-23-2021, 11:02 AM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,638

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by saeeddeep View Post
yes, forwarding all content of /var/log/messages to rsyslog server is required.
cat file | nc .. before start forwarding logs solved this requirement. thanks TB0ne
Why was it 'required', and why wouldn't just copying/appending the file fit the 'requirement'?? And again, please do basic research first per the "Question Guidelines".
 
  


Reply

Tags
rsyslog, rsyslogd



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
Clients suddenly stops forwarding log messages to remote rsyslog server kathirvel1ly4u Linux - Server 7 10-21-2020 04:15 AM
[rsyslog] how to get the original IP address in rsyslog relay chain wolf4666 Linux - Software 4 10-18-2018 09:17 AM
[SOLVED] Every two minutes rsyslog outputs - rsyslogd: action 'action 3' resumed (module 'builtin:omfile') [v8.32.0 try http://www.rsyslog.com/e/2359 Toadman Linux - Software 9 09-01-2018 12:41 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 11:31 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