Skip to content

Commit

Permalink
Store position and buffer files under the top installation directory. (
Browse files Browse the repository at this point in the history
  • Loading branch information
igorpeshansky authored Jun 24, 2022
1 parent ea3465d commit 90e984f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion windows-installer/fluent-template.conf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<match **>
@type google_cloud
buffer_type file
buffer_path /var/log/google-fluentd/buffers
buffer_path BUFFER_PATH_PLACE_HOLDER
# Set the chunk limit conservatively to avoid exceeding the recommended
# chunk size of 10MB per write request. The API request size can be a few
# times bigger than the raw log size.
Expand Down
22 changes: 19 additions & 3 deletions windows-installer/setup.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@
; Directory where the fluentd config will be placed.
!define FLUENTD_CONFIG_DIRECTORY "$INSTDIR"

; Directory under which the buffer files will be stored.
!define BUFFER_FILE_DIRECTORY "$INSTDIR\buffers"

; Directory under which the pos files will be stored.
!define POS_FILE_DIRECTORY "$INSTDIR\pos"

; Directory for the user to add custom configs.
!define CUSTOM_CONFIG_DIR "config.d"

Expand Down Expand Up @@ -167,7 +173,7 @@ Section "Install"
; Create a directory for the extracted files.
CreateDirectory ${MAIN_INSTDIR}
; Extract the needed files and show status.
${Print} "Extracting files to $INSTDIR..."
${Print} "Extracting files to $MAIN_INSTDIR..."
nsisunz::Unzip "$OUTDIR\${ZIP_FILE}" "${MAIN_INSTDIR}"
Pop $0

Expand All @@ -182,8 +188,10 @@ Section "Install"
; Delete the zip file after extraction.
Delete "$OUTDIR\${ZIP_FILE}"

; Create a directory to store buffer files.
CreateDirectory ${BUFFER_FILE_DIRECTORY}
; Create a directory to store position files.
CreateDirectory ${MAIN_INSTDIR}\pos
CreateDirectory ${POS_FILE_DIRECTORY}
; Create a directory for custom configs.
CreateDirectory "${FLUENTD_CONFIG_DIRECTORY}\${CUSTOM_CONFIG_DIR}"

Expand Down Expand Up @@ -213,12 +221,20 @@ Section "Install"
; Trim out newlines as WordFind cannot handle them.
${StrTrimNewLines} $3 "$2"

; Look for 'BUFFER_PATH_PLACE_HOLDER', if found replace it with the
; proper path.
${WordFind} "$3" "BUFFER_PATH_PLACE_HOLDER" "#" $4
${If} $4 == "1"
; Replace the whole line instead of using "StrRep" to avoid unicode issues.
StrCpy $2 " buffer_path '${BUFFER_FILE_DIRECTORY}'$\r$\n"
${EndIf}

; Look for 'WIN_EVT_POS_FILE_PLACE_HOLDER', if found replace it with the
; proper pos_file.
${WordFind} "$3" "WIN_EVT_POS_FILE_PLACE_HOLDER" "#" $4
${If} $4 == "1"
; Replace the whole line instead of using "StrRep" to avoid unicode issues.
StrCpy $2 " path '${MAIN_INSTDIR}\pos\winevtlog.pos'$\r$\n"
StrCpy $2 " path '${POS_FILE_DIRECTORY}\winevtlog.pos'$\r$\n"
${EndIf}

; Look for 'CUSTOM_CONFIG_PLACE_HOLDER', if found replace it with the
Expand Down

0 comments on commit 90e984f

Please sign in to comment.