LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS
User Name
Password
CentOS This forum is for the discussion of CentOS Linux. Note: This forum does not have any official participation.

Notices


Reply
  Search this Thread
Old 08-04-2018, 01:53 AM   #1
yasharalimz
LQ Newbie
 
Registered: Jul 2018
Posts: 1

Rep: Reputation: Disabled
I want to get a customized log for RPM installation/uninstallation packages.


Dear all

I am working on a SIEM platform "ArcSight" and I need RPM packages installation/uninstallation logs in Linux CentOS. I searched for a directory/file containing related logs but I couldn't find a way. I just got that I can query these logs via command "rpm -qa".

ASSUMPTION:

#I use below command to get the log:
rpm -qa --qf '%{INSTALLTIME} (%{INSTALLTIME:date}): %{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' | sort -n

#output:
1532931951 (Mon 30 Jul 2018 10:55:51 AM IRDT): samba-client-4.7.1-6.el7.x86_64

PROBLEM:

I need to customize the time of installation in below format:
yyyy-MM-dd HH:mm:ss
e.g: 2018-08-04 11:16:22

I tried to edit the above query in order to get my customized output but I faced errors.

MY first edit:
rpm -qa --qf '%{INSTALLTIME} (%{INSTALLTIME:date yyyy-MM-dd HH:mm:ss}): %{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' | sort -n

Output: error: incorrect format: unknown tag
 
Old 08-04-2018, 04:06 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
I don't know if you can mangle the date/time like that in the rpm command itself, but if you post-process it that date can be fed directly into the "date" command and reformatted. Very handy feature.
Use whatever "language" you are comfortable with that allows you to invoke a system command - awk, perl, python, ...
 
Old 08-04-2018, 04:27 AM   #3
jsbjsb001
Senior Member
 
Registered: Mar 2009
Location: Earth, unfortunately...
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,881

Rep: Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063
Quote:
Originally Posted by syg00 View Post
I don't know if you can mangle the date/time like that in the rpm command itself,...
Reading the man page for the rpm command, it seems you can.

@yasharalimz,

Have you read the rpm man page?

If this is a script, please post it using CODE tags.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
rhel packages uninstallation logs usamamirza Linux - Server 5 08-26-2015 11:20 AM
RPM installation and uninstallation SlipAway172 Fedora 4 12-06-2004 07:58 PM
Uninstallation of the installed packages? wittyguysuku Linux - Newbie 3 08-24-2004 04:55 AM
rpm removed packages log? jpokrzyk Linux - General 1 02-14-2004 11:24 PM
Advanced Compiling and Uninstallation Of Packages From Source LinuxGeek Linux - Software 6 06-29-2002 09:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS

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