For log "rotation" in Postgres you may want to look into postgres table partitioning ( https://www.postgresql.org/docs/current/ddl-partitioning.html ) or even better Timescale ( https://www.timescale.com/ ) where timescale will handle partitioning for you, both solutions offer a level of round robin database features on top of SQL.
On Wed, Sep 1, 2021 at 8:23 AM Mariusz Kruk via rsyslog < [email protected]> wrote: > 1. As with dynamic files, rsyslog doesn't bother with rotating files and > any such maintenance (why should it? ;-)). So you can create a template > that inserts entries into a dynamically named table but removing old > tables is entirely up to you. > > 2. Just use a separate ruleset logging into a postgresql database and > tie it to the input on port 514. Like (very simple exapmple) > > ruleset(name="log_to_pg") { > > action(type="ompgsql" [...]) > > } > > input(type="imptcp" port="5514" ruleset="log_to_pg") > > On 01.09.2021 14:14, Istvan Kassai via rsyslog wrote: > > Hi folks! > > > > I'm new on this list, and would like to ask two questions I can't solve. > > I have to collect logs into a postgres db table. It already works. The 2 > > problems occured: > > 1, How can I rotate log tables? Is there an inbuilt solution to rename > log > > table at every midnights, or I have to do it from outside with a cron > > script? > > 2, Every messages are logged into the database. I want to log local > > messages to be logged as before into files, and ONLY the remotely > generated > > messages to be written into database. I configured tcp/5514 port for it, > > and when I try it with "logger -P 5514 MESSAGETEXT" I can see in the > table. > > So if a message comes in through the tcp/5514 go to the database, every > > other to the files as before. > > > > thanks a lot > > Istvan > > _______________________________________________ > > rsyslog mailing list > > https://lists.adiscon.net/mailman/listinfo/rsyslog > > http://www.rsyslog.com/professional-services/ > > What's up with rsyslog? Follow https://twitter.com/rgerhards > > NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad > of sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you > DON'T LIKE THAT. > _______________________________________________ > rsyslog mailing list > https://lists.adiscon.net/mailman/listinfo/rsyslog > http://www.rsyslog.com/professional-services/ > What's up with rsyslog? Follow https://twitter.com/rgerhards > NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad > of sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you > DON'T LIKE THAT. _______________________________________________ rsyslog mailing list https://lists.adiscon.net/mailman/listinfo/rsyslog http://www.rsyslog.com/professional-services/ What's up with rsyslog? Follow https://twitter.com/rgerhards NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad of sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you DON'T LIKE THAT.

