Logfiles ending with ".1" [closed] - linux

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
Improve this question
Why my logsfiles ending with ".1" ?
Its just a new file for log ?
-rw-r----- 1 root adm 0 Mar 14 10:56 auth.log
-rw-r----- 1 root adm 8998827 Mar 14 00:00 auth.log.1
-rw-r----- 1 root adm 5241 Mar 14 10:55 daemon.log
-rw-r----- 1 root adm 97769 Mar 14 00:00 daemon.log.1
-rw-r----- 1 root adm 0 Mar 14 00:00 debug
-rw-r----- 1 root adm 16853 Mar 11 20:51 debug.1
-rw-r----- 1 root adm 0 Mar 14 00:00 kern.log
-rw-r----- 1 root adm 87015 Mar 11 20:51 kern.log.1
-rw-rw-r-- 1 root utmp 292292 Mar 14 10:39 lastlog
-rw-r----- 1 root adm 154 Mar 14 00:00 messages
-rw-r----- 1 root adm 73418 Mar 14 00:00 messages.1
-rw-r----- 1 root adm 0 Mar 14 00:00 user.log
-rw-r----- 1 root adm 2168 Mar 11 20:51 user.log.1

It looks like logrotate in action. That's how it works:
Log rotation is the process that renames a current log file (e.g.,
auth.log becomes auth.log.1) and sets up a new log file (e.g.,
auth.log) for new log entries.
Rotating log files is important for several reasons. First, you
probably don't want older log files eating up too much of your disk
space. Second, when you need to analyze log data, you probably don't
want those log files to be extremely large and cumbersome. And last,
organizing log files by date probably makes spotting and analyzing
changes quite a bit easier (e.g., comparing last week's log data to
this week's).
You didn't mention the OS in question: this article, for example, described how one can set up and configure logrotate on Ubuntu 16.04.

Related

Permission denied - Even tho in group with ownership [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
Improve this question
I've created a group "certificates" and put this group as chgrp -R to /root/ca and all it's files!
Even tho I'm member of "certificates" (relooged multiple times even restarted server) and the permissions are set on drwsrwsr-x I still get the error "Permission denied" when trying to "cd /root/ca".
I tried chaning permissions and ownership and more but somehow still can't access the folder nor get any information about the folder without using "sudo".
Anyone got an idea what could be causing the problem and how to fix it, so I can access the folder if I am member of certificates?
adm_mike#sf-svr-crt01:~$ id -NG
adm_mike adm cdrom sudo dip plugdev lxd certificates
adm_mike#sf-svr-crt01:~$ sudo ls -lh /root | grep ca
drwsrwsr-x 8 root certificates 4.0K Aug 18 06:25 ca
adm_mike#sf-svr-crt01:~$ sudo ls -lh /root/ca
drwsrwsr-x 2 root certificates 4.0K Aug 18 06:28 certs
drwsrwsr-x 2 root certificates 4.0K Aug 18 06:00 config
drwsrwsr-x 2 root certificates 4.0K Aug 13 06:36 crl
-rwxrwxr-x 1 root certificates 5 Aug 13 06:37 crlnumber
-rwxrwxr-x 1 root certificates 579 Aug 18 06:25 index.txt
-rwxrwxr-x 1 root certificates 21 Aug 18 06:25 index.txt.attr
-rwxrwxr-x 1 root certificates 21 Aug 16 15:21 index.txt.attr.old
-rwxrwxr-x 1 root certificates 423 Aug 16 15:21 index.txt.old
drwsrwsr-x 2 root certificates 4.0K Aug 18 06:25 newcerts
drwsrwsr-x 2 root certificates 4.0K Aug 17 14:16 private
drwsrwsr-x 2 root certificates 4.0K Aug 18 06:13 request
-rwxrwxr-x 1 root certificates 5 Aug 18 06:25 serial
-rwxrwxr-x 1 root certificates 5 Aug 16 15:21 serial.old
adm_mike#sf-svr-crt01:~$ cd /root/ca
-bash: cd: /root/ca: Permission denied
Linux Codes as Image
In order to change to the directory /root/ca, you also need to have execute (x) permissions on top-level directories - in this case /root. Whilst in theory the solution would be to also change the group of /root, this is not recommended, as /root, should stay only accessible by the root user in all cases.
You should make a directory in a separate location, i.e. /etc/ssl/ca, and set the respective permissions there.

Delete log file in LINUX [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I have several log file in my tomcat folder - /var/lib/tomcat9/logs
drwxrwxr-x 11 root syslog 4096 Oct 01 06:25 ../
-rw-r----- 1 tomcat tomcat 5077 Oct 01 11:54 catalina.2020-10-01.log
-rw-r----- 1 tomcat tomcat 0 Oct 01 11:54 localhost.2020-10-01.log
-rw-r----- 1 tomcat tomcat 115 Oct 01 11:57 localhost_access_log..2020-10-01.txt
-rw-r----- 1 root root 1716 Oct 01 11:57 restful.2020-10-01.log
-rw-r----- 1 root root 1716 Oct 02 11:57 restful.2020-10-02.log
-rw-r----- 1 root root 1716 Oct 03 11:57 restful.2020-10-03.log
-rw-r----- 1 tomcat tomcat 1716 Oct 19 11:57 restful.log
I run the command find /var/lib/tomcat9/logs/ -type f -mtime +2 -exec rm {} ;
It delete all the file including the catalina file and localhost file.
May I know how to delete file not later than 2 days but not incuding catalina and localhost file.
Thank you.
find /var/lib/tomcat9/logs/ -type f -name "restful*" -mtime +10 -exec rm {} \;

What is the deference between 'ls -lh' and 'ls -si'? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
I have executed both the comments but the size seems different in both output.
ls -lh
total 147M
-rw------- 1 root root 3.4K Sep 30 14:58 anaconda-ks.cfg
-rw-r--r-- 1 root root 247 Sep 30 14:58 install.post.log
-rw-r--r-- 1 root root 54 Sep 30 14:58 install.postnochroot.log
-rw-r--r-- 1 root root 147M Sep 30 14:58 jdk-7u79-linux-x64.gz
ls -l --si
total 154M
-rw------- 1 root root 3.5k Sep 30 14:58 anaconda-ks.cfg
-rw-r--r-- 1 root root 247 Sep 30 14:58 install.post.log
-rw-r--r-- 1 root root 54 Sep 30 14:58 install.postnochroot.log
-rw-r--r-- 1 root root 154M Sep 30 14:58 jdk-7u79-linux-x64.gz
If you would have checked the manpage for ls with the command man ls you would have seen the following:
-l use a long listing format
-h, --human-readable
with -l and/or -s, print human readable sizes (e.g., 1K 234M
2G)
-i, --inode
print the index number of each file
-s, --size
print the allocated size of each file, in blocks
So you see, each parameter just defines what and how information will be put to the screen. What you see (the difference in size) is the -h or --human-readable command, which will output more readable filesizes instead of printing always the bytes. Using -s will print the filesize in blocks on your HDD, which depends on the block size of your filesystem. From the information provided, i would say your filesystem has a 1kb blocksize. So the real content of the file would be 3.4kb, but must fill up the blocks, so on your disk the file requires 4kb or 4 blocks of space.

Linux memory issue [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
I have a problem on my server.
When i try to start my server, it says that "there no left space on device"
If i execute the command "df", I see that on directory if full.
/dev/mapper/owegdc_vg-owegdc_logs_lv
10321208 9797004 0 100% /opt/application/owegdc/logs
When i get to the logs directory here what i see
ls -lrta
total 368
drwxr-x--- 2 oweadm grpowe 16384 Jan 15 2014 lost+found
drwxr-x--- 7 oweadm grpowe 4096 Jun 18 11:55 .
drwxr-xr-x 2 oweadm grpowe 12288 Aug 4 10:20 apache
drwxr-xr-x 2 oweadm grpowe 4096 Aug 5 00:56 batches
drwxr-xr-x 2 oweadm grpowe 4096 Sep 10 13:43 expl
drwxr-xr-x 2 oweadm grpowe 327680 Sep 10 13:50 jonas
drwxr-xr-x 11 oweadm grpowe 4096 Sep 10 13:50 ..
du -sk
9642792 .
I tried things like 'lsof' but it didn't work...
Do you have an idea ?
Thx
You could just try something like
du | sort -h -r
That would list the directories on your disk, ordered by their size descending. The first directory in the output list is the biggest one.
Better, if you're looking for large single files instead of a directory, this answer on Unix & Linux gives useful information, especially this:
find . -type f | xargs du -h | sort -rn
The output is the same, but it lists files instead of dirs.

What's the exactly differences of /etc/init.d/something and /etc/rc.local [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
When I need to create a autostartup task in Ubuntu. I always create a new file and write a bunch of commands into it. Next, I place this file in the /etc/init.d/ directory. Then, I set chmod 755 for this file. Finally, I execute the command line "update-rc.d file_name defaults" to activate it. And it works like a charm.
Recently, I found that there was another way to make it work the same to this above example. That is appending a new command line into /etc/rc.local (place it above the "exit 0" line).
So could you tell the difference between them ? Thank you very much !
To understand this problem, the first thing you should know is run level in *nix. There are total 6 run level in *nix. I won't show details of each run level, you can read more about it here.
Each run level have separate locations under /etc/:
% cuonglm at ~
% ls -l /etc/rc* -d
drwxr-xr-x 2 root root 4096 Feb 20 10:44 /etc/rc0.d
drwxr-xr-x 2 root root 4096 Feb 20 10:44 /etc/rc1.d
drwxr-xr-x 2 root root 4096 Feb 20 10:44 /etc/rc2.d
drwxr-xr-x 2 root root 4096 Feb 20 10:44 /etc/rc3.d
drwxr-xr-x 2 root root 4096 Feb 20 10:44 /etc/rc4.d
drwxr-xr-x 2 root root 4096 Feb 20 10:44 /etc/rc5.d
drwxr-xr-x 2 root root 4096 Feb 20 10:44 /etc/rc6.d
-rwxr-xr-x 1 root root 306 Feb 4 18:58 /etc/rc.local
drwxr-xr-x 2 root root 4096 Feb 4 19:01 /etc/rcS.d
Everytime your system boots, some scripts (which start with S) under the coressponding run level folder is executed. I.E if you boot in to run level 2, some scripts under /etc/rc2.d/ will executed. If you show content of these folder, you'll see that scripts is a symlink of scripts under /etc/init.d/.
% ls -l /etc/rc2.d/
total 4
-rw-r--r-- 1 root root 677 Jul 27 2012 README
lrwxrwxrwx 1 root root 20 Feb 19 11:26 S20kerneloops -> ../init.d/kerneloops
lrwxrwxrwx 1 root root 27 Feb 19 11:26 S20speech-dispatcher -> ../init.d/speech-dispatcher
lrwxrwxrwx 1 root root 20 Feb 19 11:26 S50pulseaudio -> ../init.d/pulseaudio
lrwxrwxrwx 1 root root 15 Feb 19 11:26 S50rsync -> ../init.d/rsync
lrwxrwxrwx 1 root root 15 Feb 19 11:26 S50saned -> ../init.d/saned
lrwxrwxrwx 1 root root 19 Feb 19 11:26 S70dns-clean -> ../init.d/dns-clean
lrwxrwxrwx 1 root root 18 Feb 19 11:26 S70pppd-dns -> ../init.d/pppd-dns
lrwxrwxrwx 1 root root 14 Feb 19 11:26 S75sudo -> ../init.d/sudo
lrwxrwxrwx 1 root root 17 Feb 20 10:44 S91apache2 -> ../init.d/apache2
lrwxrwxrwx 1 root root 22 Feb 19 11:26 S99acpi-support -> ../init.d/acpi-support
lrwxrwxrwx 1 root root 21 Feb 19 11:26 S99grub-common -> ../init.d/grub-common
lrwxrwxrwx 1 root root 18 Feb 19 11:26 S99ondemand -> ../init.d/ondemand
lrwxrwxrwx 1 root root 18 Feb 19 11:26 S99rc.local -> ../init.d/rc.local
This give you an ability to control your service to run under which runlevel. You can make your service run in only run level 2 and stop in others run level. But remember, Only one "runlevel" is executed on bootup, i.e. either runlevel 2 OR 3 OR 4 is executed, not 2 then 3 then 4.
So it leads you to the difference here. In each run level you boot in, after scripts of this run level is executed, the script /etc/rc.local is executed. It means that /etc/rc.local will run at the end of boot process, regardless of run level you boot in.

Resources