Skip to main content
Use python3 to call Python 3
Source Link

Use my Python 3 program copy_journal.py on the journal files in /var/log/journal from which you want to remove entries.

For instance, to make a copy of system.journal without log entries for NetworkManager.service:

$ journalctl --file=system.journal | wc 167 1934 18825 $ journalctl --file=system.journal | grep -v NetworkManager | wc 77 881 8421 $ pythonpython3 copy_journal.py --remove-unit=NetworkManager.service system.journal system-without-nm.journal $ journalctl --file=system-without-nm.journal | wc 77 881 8421 

Use my Python 3 program copy_journal.py on the journal files in /var/log/journal from which you want to remove entries.

For instance, to make a copy of system.journal without log entries for NetworkManager.service:

$ journalctl --file=system.journal | wc 167 1934 18825 $ journalctl --file=system.journal | grep -v NetworkManager | wc 77 881 8421 $ python copy_journal.py --remove-unit=NetworkManager.service system.journal system-without-nm.journal $ journalctl --file=system-without-nm.journal | wc 77 881 8421 

Use my Python 3 program copy_journal.py on the journal files in /var/log/journal from which you want to remove entries.

For instance, to make a copy of system.journal without log entries for NetworkManager.service:

$ journalctl --file=system.journal | wc 167 1934 18825 $ journalctl --file=system.journal | grep -v NetworkManager | wc 77 881 8421 $ python3 copy_journal.py --remove-unit=NetworkManager.service system.journal system-without-nm.journal $ journalctl --file=system-without-nm.journal | wc 77 881 8421 
Source Link

Use my Python 3 program copy_journal.py on the journal files in /var/log/journal from which you want to remove entries.

For instance, to make a copy of system.journal without log entries for NetworkManager.service:

$ journalctl --file=system.journal | wc 167 1934 18825 $ journalctl --file=system.journal | grep -v NetworkManager | wc 77 881 8421 $ python copy_journal.py --remove-unit=NetworkManager.service system.journal system-without-nm.journal $ journalctl --file=system-without-nm.journal | wc 77 881 8421