logrotate is done with smaller files than 10M every hour regarding configuration (Elastic Beanstalk) [on hold]

Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
Context:
I have an elastic beanstalk application with linux ec2, when i enter via SSH and I check the configuration i noticed it is not working as expected (from the configuration files)
My logfiles are being rotated every hour no matter the file size
This is my configuration file
/var/log/nodejs/nodejs.log
size 10M
missingok
notifempty
rotate 5
sharedscripts
compress
copytruncate
dateext
dateformat -%s
olddir /var/log/nodejs/rotated
postrotate
/etc/init.d/rsyslog restart > /dev/null
endscript
And my logs are very small, but anyway they are rotated every hour without exception.
The output when running logrotate in debug mode is as follows
sudo logrotate -d --force /etc/logrotate.elasticbeanstalk.hourly/logrotate.elasticbeanstalk.nodejs.conf
reading config file /etc/logrotate.elasticbeanstalk.hourly/logrotate.elasticbeanstalk.nodejs.conf
reading config info for /var/log/nodejs/nodejs.log
olddir is now /var/log/nodejs/rotated
Handling 1 logs
rotating pattern: /var/log/nodejs/nodejs.log forced from command line (5 rotations)
olddir is /var/log/nodejs/rotated, empty log files are not rotated, old logs are removed
considering log /var/log/nodejs/nodejs.log
log needs rotating
rotating log /var/log/nodejs/nodejs.log, log->rotateCount is 5
Converted ' -%s' -> '-%s'
dateext suffix '-1540853132'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
copying /var/log/nodejs/nodejs.log to /var/log/nodejs/rotated/nodejs.log-1540853132
truncating /var/log/nodejs/nodejs.log
running postrotate script
running script with arg /var/log/nodejs/nodejs.log : "
/etc/init.d/rsyslog restart > /dev/null
"
compressing log with: /bin/gzip
removing old log /var/log/nodejs/rotated/nodejs.log-1540851226.gz
After I realized that it force the rotation, so i did another check without --force option
sudo logrotate -d /etc/logrotate.elasticbeanstalk.hourly/logrotate.elasticbeanstalk.nodejs.conf
and i received this information
reading config file
/etc/logrotate.elasticbeanstalk.hourly/logrotate.elasticbeanstalk.nodejs.conf
reading config info for /var/log/nodejs/nodejs.log
olddir is now /var/log/nodejs/rotated
Handling 1 logs
rotating pattern: /var/log/nodejs/nodejs.log 10485760 bytes (5 rotations)
olddir is /var/log/nodejs/rotated, empty log files are not rotated, old logs are removed
considering log /var/log/nodejs/nodejs.log
log does not need rotating
not running postrotate script, since no logs were rotated
But for some strange reason when i see the files rotated every hour the size is minimal,
drwxr-xr-x 3 nodejs root 4.0K Oct 29 19:13 ..
-rw-r--r-- 1 root root 2.4K Oct 30 01:01 nodejs.log-1540861261.gz
-rw-r--r-- 1 root root 2.4K Oct 30 02:01 nodejs.log-1540864861.gz
-rw-r--r-- 1 root root 2.3K Oct 30 03:01 nodejs.log-1540868461.gz
-rw-r--r-- 1 root root 2.4K Oct 30 04:01 nodejs.log-1540872062.gz
-rw-r--r-- 1 root root 2.4K Oct 30 05:01 nodejs.log-1540875661.gz
Solution
Finally I noticed that the elastic beanstalk application itself have an option specific for that, I guess it is an underlying configuration for sending logs to S3 or Cloudwatch, so I disabled that option and it works fine now.
The option is
Rotate logs: disabled(default)
linux logrotate
put on hold as unclear what you're asking by Jeff Schaller, Isaac, RalfFriedl, schily, Archemar 8 hours ago
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, itâÂÂs hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |Â
up vote
0
down vote
favorite
Context:
I have an elastic beanstalk application with linux ec2, when i enter via SSH and I check the configuration i noticed it is not working as expected (from the configuration files)
My logfiles are being rotated every hour no matter the file size
This is my configuration file
/var/log/nodejs/nodejs.log
size 10M
missingok
notifempty
rotate 5
sharedscripts
compress
copytruncate
dateext
dateformat -%s
olddir /var/log/nodejs/rotated
postrotate
/etc/init.d/rsyslog restart > /dev/null
endscript
And my logs are very small, but anyway they are rotated every hour without exception.
The output when running logrotate in debug mode is as follows
sudo logrotate -d --force /etc/logrotate.elasticbeanstalk.hourly/logrotate.elasticbeanstalk.nodejs.conf
reading config file /etc/logrotate.elasticbeanstalk.hourly/logrotate.elasticbeanstalk.nodejs.conf
reading config info for /var/log/nodejs/nodejs.log
olddir is now /var/log/nodejs/rotated
Handling 1 logs
rotating pattern: /var/log/nodejs/nodejs.log forced from command line (5 rotations)
olddir is /var/log/nodejs/rotated, empty log files are not rotated, old logs are removed
considering log /var/log/nodejs/nodejs.log
log needs rotating
rotating log /var/log/nodejs/nodejs.log, log->rotateCount is 5
Converted ' -%s' -> '-%s'
dateext suffix '-1540853132'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
copying /var/log/nodejs/nodejs.log to /var/log/nodejs/rotated/nodejs.log-1540853132
truncating /var/log/nodejs/nodejs.log
running postrotate script
running script with arg /var/log/nodejs/nodejs.log : "
/etc/init.d/rsyslog restart > /dev/null
"
compressing log with: /bin/gzip
removing old log /var/log/nodejs/rotated/nodejs.log-1540851226.gz
After I realized that it force the rotation, so i did another check without --force option
sudo logrotate -d /etc/logrotate.elasticbeanstalk.hourly/logrotate.elasticbeanstalk.nodejs.conf
and i received this information
reading config file
/etc/logrotate.elasticbeanstalk.hourly/logrotate.elasticbeanstalk.nodejs.conf
reading config info for /var/log/nodejs/nodejs.log
olddir is now /var/log/nodejs/rotated
Handling 1 logs
rotating pattern: /var/log/nodejs/nodejs.log 10485760 bytes (5 rotations)
olddir is /var/log/nodejs/rotated, empty log files are not rotated, old logs are removed
considering log /var/log/nodejs/nodejs.log
log does not need rotating
not running postrotate script, since no logs were rotated
But for some strange reason when i see the files rotated every hour the size is minimal,
drwxr-xr-x 3 nodejs root 4.0K Oct 29 19:13 ..
-rw-r--r-- 1 root root 2.4K Oct 30 01:01 nodejs.log-1540861261.gz
-rw-r--r-- 1 root root 2.4K Oct 30 02:01 nodejs.log-1540864861.gz
-rw-r--r-- 1 root root 2.3K Oct 30 03:01 nodejs.log-1540868461.gz
-rw-r--r-- 1 root root 2.4K Oct 30 04:01 nodejs.log-1540872062.gz
-rw-r--r-- 1 root root 2.4K Oct 30 05:01 nodejs.log-1540875661.gz
Solution
Finally I noticed that the elastic beanstalk application itself have an option specific for that, I guess it is an underlying configuration for sending logs to S3 or Cloudwatch, so I disabled that option and it works fine now.
The option is
Rotate logs: disabled(default)
linux logrotate
put on hold as unclear what you're asking by Jeff Schaller, Isaac, RalfFriedl, schily, Archemar 8 hours ago
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, itâÂÂs hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
4
How did you runlogrotatewhen you got that output? It says rotation is forced...
â Kusalananda
yesterday
i ran sudo logrotate --force /etc/logrotate.elasticbeanstalk.hourly/logrotate.elasticbeanstalk.nodejs.conf
â Omar Alvarado
yesterday
the "minimal" size may very well be due to the fact that you've enabled the "compress" option. 10 Mb could conceivably compress down to 2 Kb if the data was repetitive. You could confirm the pre-rotation size with something likezcat nodejs.log-1540875661.gz | wc -c
â Jeff Schaller
yesterday
The command for a file with the same size is $ zcat nodejs.log-1540900861.gz | wc -c 38700
â Omar Alvarado
yesterday
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Context:
I have an elastic beanstalk application with linux ec2, when i enter via SSH and I check the configuration i noticed it is not working as expected (from the configuration files)
My logfiles are being rotated every hour no matter the file size
This is my configuration file
/var/log/nodejs/nodejs.log
size 10M
missingok
notifempty
rotate 5
sharedscripts
compress
copytruncate
dateext
dateformat -%s
olddir /var/log/nodejs/rotated
postrotate
/etc/init.d/rsyslog restart > /dev/null
endscript
And my logs are very small, but anyway they are rotated every hour without exception.
The output when running logrotate in debug mode is as follows
sudo logrotate -d --force /etc/logrotate.elasticbeanstalk.hourly/logrotate.elasticbeanstalk.nodejs.conf
reading config file /etc/logrotate.elasticbeanstalk.hourly/logrotate.elasticbeanstalk.nodejs.conf
reading config info for /var/log/nodejs/nodejs.log
olddir is now /var/log/nodejs/rotated
Handling 1 logs
rotating pattern: /var/log/nodejs/nodejs.log forced from command line (5 rotations)
olddir is /var/log/nodejs/rotated, empty log files are not rotated, old logs are removed
considering log /var/log/nodejs/nodejs.log
log needs rotating
rotating log /var/log/nodejs/nodejs.log, log->rotateCount is 5
Converted ' -%s' -> '-%s'
dateext suffix '-1540853132'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
copying /var/log/nodejs/nodejs.log to /var/log/nodejs/rotated/nodejs.log-1540853132
truncating /var/log/nodejs/nodejs.log
running postrotate script
running script with arg /var/log/nodejs/nodejs.log : "
/etc/init.d/rsyslog restart > /dev/null
"
compressing log with: /bin/gzip
removing old log /var/log/nodejs/rotated/nodejs.log-1540851226.gz
After I realized that it force the rotation, so i did another check without --force option
sudo logrotate -d /etc/logrotate.elasticbeanstalk.hourly/logrotate.elasticbeanstalk.nodejs.conf
and i received this information
reading config file
/etc/logrotate.elasticbeanstalk.hourly/logrotate.elasticbeanstalk.nodejs.conf
reading config info for /var/log/nodejs/nodejs.log
olddir is now /var/log/nodejs/rotated
Handling 1 logs
rotating pattern: /var/log/nodejs/nodejs.log 10485760 bytes (5 rotations)
olddir is /var/log/nodejs/rotated, empty log files are not rotated, old logs are removed
considering log /var/log/nodejs/nodejs.log
log does not need rotating
not running postrotate script, since no logs were rotated
But for some strange reason when i see the files rotated every hour the size is minimal,
drwxr-xr-x 3 nodejs root 4.0K Oct 29 19:13 ..
-rw-r--r-- 1 root root 2.4K Oct 30 01:01 nodejs.log-1540861261.gz
-rw-r--r-- 1 root root 2.4K Oct 30 02:01 nodejs.log-1540864861.gz
-rw-r--r-- 1 root root 2.3K Oct 30 03:01 nodejs.log-1540868461.gz
-rw-r--r-- 1 root root 2.4K Oct 30 04:01 nodejs.log-1540872062.gz
-rw-r--r-- 1 root root 2.4K Oct 30 05:01 nodejs.log-1540875661.gz
Solution
Finally I noticed that the elastic beanstalk application itself have an option specific for that, I guess it is an underlying configuration for sending logs to S3 or Cloudwatch, so I disabled that option and it works fine now.
The option is
Rotate logs: disabled(default)
linux logrotate
Context:
I have an elastic beanstalk application with linux ec2, when i enter via SSH and I check the configuration i noticed it is not working as expected (from the configuration files)
My logfiles are being rotated every hour no matter the file size
This is my configuration file
/var/log/nodejs/nodejs.log
size 10M
missingok
notifempty
rotate 5
sharedscripts
compress
copytruncate
dateext
dateformat -%s
olddir /var/log/nodejs/rotated
postrotate
/etc/init.d/rsyslog restart > /dev/null
endscript
And my logs are very small, but anyway they are rotated every hour without exception.
The output when running logrotate in debug mode is as follows
sudo logrotate -d --force /etc/logrotate.elasticbeanstalk.hourly/logrotate.elasticbeanstalk.nodejs.conf
reading config file /etc/logrotate.elasticbeanstalk.hourly/logrotate.elasticbeanstalk.nodejs.conf
reading config info for /var/log/nodejs/nodejs.log
olddir is now /var/log/nodejs/rotated
Handling 1 logs
rotating pattern: /var/log/nodejs/nodejs.log forced from command line (5 rotations)
olddir is /var/log/nodejs/rotated, empty log files are not rotated, old logs are removed
considering log /var/log/nodejs/nodejs.log
log needs rotating
rotating log /var/log/nodejs/nodejs.log, log->rotateCount is 5
Converted ' -%s' -> '-%s'
dateext suffix '-1540853132'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
copying /var/log/nodejs/nodejs.log to /var/log/nodejs/rotated/nodejs.log-1540853132
truncating /var/log/nodejs/nodejs.log
running postrotate script
running script with arg /var/log/nodejs/nodejs.log : "
/etc/init.d/rsyslog restart > /dev/null
"
compressing log with: /bin/gzip
removing old log /var/log/nodejs/rotated/nodejs.log-1540851226.gz
After I realized that it force the rotation, so i did another check without --force option
sudo logrotate -d /etc/logrotate.elasticbeanstalk.hourly/logrotate.elasticbeanstalk.nodejs.conf
and i received this information
reading config file
/etc/logrotate.elasticbeanstalk.hourly/logrotate.elasticbeanstalk.nodejs.conf
reading config info for /var/log/nodejs/nodejs.log
olddir is now /var/log/nodejs/rotated
Handling 1 logs
rotating pattern: /var/log/nodejs/nodejs.log 10485760 bytes (5 rotations)
olddir is /var/log/nodejs/rotated, empty log files are not rotated, old logs are removed
considering log /var/log/nodejs/nodejs.log
log does not need rotating
not running postrotate script, since no logs were rotated
But for some strange reason when i see the files rotated every hour the size is minimal,
drwxr-xr-x 3 nodejs root 4.0K Oct 29 19:13 ..
-rw-r--r-- 1 root root 2.4K Oct 30 01:01 nodejs.log-1540861261.gz
-rw-r--r-- 1 root root 2.4K Oct 30 02:01 nodejs.log-1540864861.gz
-rw-r--r-- 1 root root 2.3K Oct 30 03:01 nodejs.log-1540868461.gz
-rw-r--r-- 1 root root 2.4K Oct 30 04:01 nodejs.log-1540872062.gz
-rw-r--r-- 1 root root 2.4K Oct 30 05:01 nodejs.log-1540875661.gz
Solution
Finally I noticed that the elastic beanstalk application itself have an option specific for that, I guess it is an underlying configuration for sending logs to S3 or Cloudwatch, so I disabled that option and it works fine now.
The option is
Rotate logs: disabled(default)
linux logrotate
linux logrotate
edited 26 mins ago
asked yesterday
Omar Alvarado
11
11
put on hold as unclear what you're asking by Jeff Schaller, Isaac, RalfFriedl, schily, Archemar 8 hours ago
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, itâÂÂs hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
put on hold as unclear what you're asking by Jeff Schaller, Isaac, RalfFriedl, schily, Archemar 8 hours ago
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, itâÂÂs hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
4
How did you runlogrotatewhen you got that output? It says rotation is forced...
â Kusalananda
yesterday
i ran sudo logrotate --force /etc/logrotate.elasticbeanstalk.hourly/logrotate.elasticbeanstalk.nodejs.conf
â Omar Alvarado
yesterday
the "minimal" size may very well be due to the fact that you've enabled the "compress" option. 10 Mb could conceivably compress down to 2 Kb if the data was repetitive. You could confirm the pre-rotation size with something likezcat nodejs.log-1540875661.gz | wc -c
â Jeff Schaller
yesterday
The command for a file with the same size is $ zcat nodejs.log-1540900861.gz | wc -c 38700
â Omar Alvarado
yesterday
add a comment |Â
4
How did you runlogrotatewhen you got that output? It says rotation is forced...
â Kusalananda
yesterday
i ran sudo logrotate --force /etc/logrotate.elasticbeanstalk.hourly/logrotate.elasticbeanstalk.nodejs.conf
â Omar Alvarado
yesterday
the "minimal" size may very well be due to the fact that you've enabled the "compress" option. 10 Mb could conceivably compress down to 2 Kb if the data was repetitive. You could confirm the pre-rotation size with something likezcat nodejs.log-1540875661.gz | wc -c
â Jeff Schaller
yesterday
The command for a file with the same size is $ zcat nodejs.log-1540900861.gz | wc -c 38700
â Omar Alvarado
yesterday
4
4
How did you run
logrotate when you got that output? It says rotation is forced...â Kusalananda
yesterday
How did you run
logrotate when you got that output? It says rotation is forced...â Kusalananda
yesterday
i ran sudo logrotate --force /etc/logrotate.elasticbeanstalk.hourly/logrotate.elasticbeanstalk.nodejs.conf
â Omar Alvarado
yesterday
i ran sudo logrotate --force /etc/logrotate.elasticbeanstalk.hourly/logrotate.elasticbeanstalk.nodejs.conf
â Omar Alvarado
yesterday
the "minimal" size may very well be due to the fact that you've enabled the "compress" option. 10 Mb could conceivably compress down to 2 Kb if the data was repetitive. You could confirm the pre-rotation size with something like
zcat nodejs.log-1540875661.gz | wc -câ Jeff Schaller
yesterday
the "minimal" size may very well be due to the fact that you've enabled the "compress" option. 10 Mb could conceivably compress down to 2 Kb if the data was repetitive. You could confirm the pre-rotation size with something like
zcat nodejs.log-1540875661.gz | wc -câ Jeff Schaller
yesterday
The command for a file with the same size is $ zcat nodejs.log-1540900861.gz | wc -c 38700
â Omar Alvarado
yesterday
The command for a file with the same size is $ zcat nodejs.log-1540900861.gz | wc -c 38700
â Omar Alvarado
yesterday
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
4
How did you run
logrotatewhen you got that output? It says rotation is forced...â Kusalananda
yesterday
i ran sudo logrotate --force /etc/logrotate.elasticbeanstalk.hourly/logrotate.elasticbeanstalk.nodejs.conf
â Omar Alvarado
yesterday
the "minimal" size may very well be due to the fact that you've enabled the "compress" option. 10 Mb could conceivably compress down to 2 Kb if the data was repetitive. You could confirm the pre-rotation size with something like
zcat nodejs.log-1540875661.gz | wc -câ Jeff Schaller
yesterday
The command for a file with the same size is $ zcat nodejs.log-1540900861.gz | wc -c 38700
â Omar Alvarado
yesterday