Each of the files from this list has been updated today. You can use the exec option of the find command to invoke ls command and show timestamps for each file:
greys@server:~ $ sudo find /var/log -mtime 0 -exec ls -ld {} \;
-rw------- 1 root root 1732312 Oct 20 17:18 /var/log/secure
-rw-rw-r--. 1 root utmp 105600 Oct 20 17:15 /var/log/wtmp
drwxr-xr-x 2 dd-agent dd-agent 4096 Oct 20 10:23 /var/log/datadog
-rw-r--r-- 1 dd-agent dd-agent 2639084 Oct 20 17:18 /var/log/datadog/trace-agent.log
-rw-r--r-- 1 dd-agent dd-agent 10485782 Oct 20 10:23 /var/log/datadog/agent.log.329
-rw-r--r-- 1 dd-agent dd-agent 6271115 Oct 20 17:18 /var/log/datadog/agent.log
-rw-r--r--. 1 root root 292876 Oct 20 17:15 /var/log/lastlog
-rw------- 1 root root 188372446 Oct 20 17:18 /var/log/messages
drwx------. 2 root root 4096 Oct 20 06:32 /var/log/audit
-rw------- 1 root root 2567908 Oct 20 17:18 /var/log/audit/audit.log
-r-------- 1 root root 8388638 Oct 20 06:32 /var/log/audit/audit.log.1
-rw------- 1 root root 41498 Oct 20 17:01 /var/log/cron
-rw------- 1 root utmp 6091392 Oct 20 17:14 /var/log/btmp
drwxr-xr-x 2 grafana grafana 4096 Oct 20 09:59 /var/log/grafana
-rw-r--r-- 1 grafana grafana 172 Oct 20 09:59 /var/log/grafana/grafana.log
-rw-r--r-- 1 grafana grafana 524 Oct 19 22:09 /var/log/grafana/grafana.log.2018-10-20.001
Find files modified more than 7 days ago
This doesn’t have to be 7 days, you can specify any number here. This command is useful for confirming which (log) files haven’t been modified for more than a week – it could mean they are safe to delete.
This is how a start of such a list would look (bear in mind I’m running this on October 20th, 2018):
Again, this doesn’t have to be exactly 30 days, it can be any number. I’m using 30 because it’s roughly 1 month and is a round enough number for backup/restore points.
Here I’m checking what’s been updated in my home directory in the past 30 days:
I'm a principal consultant with Tech Stack Solutions. I help with cloud architectrure, AWS deployments and automated management of Unix/Linux infrastructure. Get in touch!