public inbox for pmg-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pmg-devel] [pmg-log-tracker] fix logfile counting in months != january
@ 2022-02-01  9:48 Stoiko Ivanov
  2022-02-01 10:03 ` Aaron Lauterer
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Stoiko Ivanov @ 2022-02-01  9:48 UTC (permalink / raw)
  To: pmg-devel

the changes introduced in 1cdbebe57b2ddc255db240d7dbaf2165c482986d

changed the date handling to have current_month and current_year
represent the month and year at time of invocation.
This change was not carried over to the logfile collecting, which set
the current month to january.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
* sorry for missing this in the first round of patches (hardcoded january was
  overlooked in january...)
* tested with logs from a live-system.

 src/main.rs | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/main.rs b/src/main.rs
index fb06463..2ba1b99 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1802,7 +1802,6 @@ impl Parser {
         } else {
             let filecount = self.count_files_in_time_range();
             for i in (0..filecount).rev() {
-                self.current_month = 0;
                 if let Ok(file) = File::open(LOGFILES[i]) {
                     self.current_file_index = i;
                     if i > 1 {
@@ -1916,7 +1915,6 @@ impl Parser {
         let mut buffer = Vec::new();
 
         for (i, item) in LOGFILES.iter().enumerate() {
-            self.current_month = 0;
 
             count = i;
             if let Ok(file) = File::open(item) {
-- 
2.30.2





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [pmg-devel] [pmg-log-tracker] fix logfile counting in months != january
  2022-02-01  9:48 [pmg-devel] [pmg-log-tracker] fix logfile counting in months != january Stoiko Ivanov
@ 2022-02-01 10:03 ` Aaron Lauterer
  2022-02-01 11:00 ` Mira Limbeck
  2022-02-01 12:35 ` [pmg-devel] applied: " Thomas Lamprecht
  2 siblings, 0 replies; 4+ messages in thread
From: Aaron Lauterer @ 2022-02-01 10:03 UTC (permalink / raw)
  To: Stoiko Ivanov, pmg-devel

Did a quick test on a production PMG. The log tracker is working fine again.

Tested-By: Aaron Lauterer <a.lauterer@proxmox.com>


On 2/1/22 10:48, Stoiko Ivanov wrote:
> the changes introduced in 1cdbebe57b2ddc255db240d7dbaf2165c482986d
> 
> changed the date handling to have current_month and current_year
> represent the month and year at time of invocation.
> This change was not carried over to the logfile collecting, which set
> the current month to january.
> 
> Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
> ---
> * sorry for missing this in the first round of patches (hardcoded january was
>    overlooked in january...)
> * tested with logs from a live-system.
> 
>   src/main.rs | 2 --
>   1 file changed, 2 deletions(-)
> 
> diff --git a/src/main.rs b/src/main.rs
> index fb06463..2ba1b99 100644
> --- a/src/main.rs
> +++ b/src/main.rs
> @@ -1802,7 +1802,6 @@ impl Parser {
>           } else {
>               let filecount = self.count_files_in_time_range();
>               for i in (0..filecount).rev() {
> -                self.current_month = 0;
>                   if let Ok(file) = File::open(LOGFILES[i]) {
>                       self.current_file_index = i;
>                       if i > 1 {
> @@ -1916,7 +1915,6 @@ impl Parser {
>           let mut buffer = Vec::new();
>   
>           for (i, item) in LOGFILES.iter().enumerate() {
> -            self.current_month = 0;
>   
>               count = i;
>               if let Ok(file) = File::open(item) {




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [pmg-devel] [pmg-log-tracker] fix logfile counting in months != january
  2022-02-01  9:48 [pmg-devel] [pmg-log-tracker] fix logfile counting in months != january Stoiko Ivanov
  2022-02-01 10:03 ` Aaron Lauterer
@ 2022-02-01 11:00 ` Mira Limbeck
  2022-02-01 12:35 ` [pmg-devel] applied: " Thomas Lamprecht
  2 siblings, 0 replies; 4+ messages in thread
From: Mira Limbeck @ 2022-02-01 11:00 UTC (permalink / raw)
  To: pmg-devel

Looks good to me.

After reviewing the mentioned commit, it makes sense to not set 
self.current_month outside of Parser::new().

We no longer use it as variable for the current month in the logs, but 
rather as current month at the time of pmg-log-tracker invocation. And 
in turn we calculate all time relative to this month.

This in turn means all logs from future months will be parsed as from 
the previous year.

On 2/1/22 10:48, Stoiko Ivanov wrote:
> the changes introduced in 1cdbebe57b2ddc255db240d7dbaf2165c482986d
>
> changed the date handling to have current_month and current_year
> represent the month and year at time of invocation.
> This change was not carried over to the logfile collecting, which set
> the current month to january.
>
> Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
> ---
> * sorry for missing this in the first round of patches (hardcoded january was
>    overlooked in january...)
> * tested with logs from a live-system.
>
>   src/main.rs | 2 --
>   1 file changed, 2 deletions(-)
>
> diff --git a/src/main.rs b/src/main.rs
> index fb06463..2ba1b99 100644
> --- a/src/main.rs
> +++ b/src/main.rs
> @@ -1802,7 +1802,6 @@ impl Parser {
>           } else {
>               let filecount = self.count_files_in_time_range();
>               for i in (0..filecount).rev() {
> -                self.current_month = 0;
>                   if let Ok(file) = File::open(LOGFILES[i]) {
>                       self.current_file_index = i;
>                       if i > 1 {
> @@ -1916,7 +1915,6 @@ impl Parser {
>           let mut buffer = Vec::new();
>   
>           for (i, item) in LOGFILES.iter().enumerate() {
> -            self.current_month = 0;
>   
>               count = i;
>               if let Ok(file) = File::open(item) {




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pmg-devel] applied: [pmg-log-tracker] fix logfile counting in months != january
  2022-02-01  9:48 [pmg-devel] [pmg-log-tracker] fix logfile counting in months != january Stoiko Ivanov
  2022-02-01 10:03 ` Aaron Lauterer
  2022-02-01 11:00 ` Mira Limbeck
@ 2022-02-01 12:35 ` Thomas Lamprecht
  2 siblings, 0 replies; 4+ messages in thread
From: Thomas Lamprecht @ 2022-02-01 12:35 UTC (permalink / raw)
  To: Stoiko Ivanov, pmg-devel

On 01.02.22 10:48, Stoiko Ivanov wrote:
> the changes introduced in 1cdbebe57b2ddc255db240d7dbaf2165c482986d
> 
> changed the date handling to have current_month and current_year
> represent the month and year at time of invocation.
> This change was not carried over to the logfile collecting, which set
> the current month to january.
> 
> Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
> ---
> * sorry for missing this in the first round of patches (hardcoded january was
>   overlooked in january...)
> * tested with logs from a live-system.
> 
>  src/main.rs | 2 --
>  1 file changed, 2 deletions(-)
> 
>

applied, thanks!




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-02-01 12:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-01  9:48 [pmg-devel] [pmg-log-tracker] fix logfile counting in months != january Stoiko Ivanov
2022-02-01 10:03 ` Aaron Lauterer
2022-02-01 11:00 ` Mira Limbeck
2022-02-01 12:35 ` [pmg-devel] applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal