Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
Wazuh
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Archive
Wazuh
Commits
4a8dbfc9
Commit
4a8dbfc9
authored
Jun 13, 2018
by
Borja
Committed by
Vikman Fdez-Castro
Jun 13, 2018
Browse files
Options
Downloads
Patches
Plain Diff
Fix log rotation in windows (#776)
* Fix log rotation in windows * Update changelog
parent
36d572ed
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGELOG.md
+1
-0
1 addition, 0 deletions
CHANGELOG.md
src/monitord/rotate_log.c
+4
-4
4 additions, 4 deletions
src/monitord/rotate_log.c
with
5 additions
and
4 deletions
CHANGELOG.md
+
1
−
0
View file @
4a8dbfc9
...
...
@@ -12,6 +12,7 @@ All notable changes to this project will be documented in this file.
-
Windows prevents agent from renaming file. (
[
#773
](
https://github.com/wazuh/wazuh/pull/773
)
)
-
Fix manager-agent version comparison in remote upgrades. (
[
#765
](
https://github.com/wazuh/wazuh/pull/765
)
)
-
Fix log flooding when restarting agent while the merged file is being receiving. (
[
#788
](
https://github.com/wazuh/wazuh/pull/788
)
)
-
Fix issue when overwriting rotated logs in Windows agents. (
[
#776
](
https://github.com/wazuh/wazuh/pull/776
)
)
## [v3.3.0]
...
...
This diff is collapsed.
Click to expand it.
src/monitord/rotate_log.c
+
4
−
4
View file @
4a8dbfc9
...
...
@@ -116,7 +116,7 @@ void w_rotate_log(int compress, int keep_log_days, int new_day, int rotate_json,
snprintf
(
old_rename_path
,
PATH_MAX
,
"%s/ossec-%02d-001.log.gz"
,
month_dir
,
tm
.
tm_mday
);
counter
=
1
;
while
(
counter
<
daily_rotations
)
{
if
(
rename
(
old_rename_path
,
rename_path
)
!=
0
)
{
if
(
rename
_ex
(
old_rename_path
,
rename_path
)
!=
0
)
{
merror
(
"Couldn't rename compressed log '%s' to '%s': '%s'"
,
old_rename_path
,
rename_path
,
strerror
(
errno
));
return
;
}
...
...
@@ -129,7 +129,7 @@ void w_rotate_log(int compress, int keep_log_days, int new_day, int rotate_json,
}
if
(
!
IsFile
(
old_path
))
{
if
(
rename
(
old_path
,
new_path
)
==
0
)
{
if
(
rename
_ex
(
old_path
,
new_path
)
==
0
)
{
if
(
compress
)
{
OS_CompressLog
(
new_path
);
}
...
...
@@ -160,7 +160,7 @@ void w_rotate_log(int compress, int keep_log_days, int new_day, int rotate_json,
snprintf
(
old_rename_path
,
PATH_MAX
,
"%s/ossec-%02d-001.json.gz"
,
month_dir
,
tm
.
tm_mday
);
counter
=
1
;
while
(
counter
<
daily_rotations
)
{
if
(
rename
(
old_rename_path
,
rename_path
)
!=
0
)
{
if
(
rename
_ex
(
old_rename_path
,
rename_path
)
!=
0
)
{
merror
(
"Couldn't rename compressed log '%s' to '%s': '%s'"
,
old_rename_path
,
rename_path
,
strerror
(
errno
));
return
;
}
...
...
@@ -173,7 +173,7 @@ void w_rotate_log(int compress, int keep_log_days, int new_day, int rotate_json,
}
if
(
!
IsFile
(
old_path_json
))
{
if
(
rename
(
old_path_json
,
new_path_json
)
==
0
)
{
if
(
rename
_ex
(
old_path_json
,
new_path_json
)
==
0
)
{
if
(
compress
)
{
OS_CompressLog
(
new_path_json
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment