Skip to content

Instantly share code, notes, and snippets.

@elvarb
Last active June 11, 2019 14:28
Show Gist options
  • Save elvarb/dd7641449eed2cf9cf342931fd8519cc to your computer and use it in GitHub Desktop.
Save elvarb/dd7641449eed2cf9cf342931fd8519cc to your computer and use it in GitHub Desktop.
Generate constant stream of data to a log file, for testing log shipping and log handling. Each line includes a ISO timestamp and a random number of characters.
# Modify start-sleep to change how frequent log lines should be generated
# Modify out-file to change target log file
#
# Example output:
# 2019-11-06 14:27:16 CHQvrjBqXbwFfUOgRc
# 2019-11-06 14:27:16 RxEOpUqrjaIeLMzoiDyAHvg
# 2019-11-06 14:27:17 DALVZYy
# 2019-11-06 14:27:17 mjlSvTENJ
# 2019-11-06 14:27:17 mHBtcDTuOZWqyKEFSdVzglMAivRjQpsw
# 2019-11-06 14:27:17 QPMpZrhtsGcxyqwuBzHfmvaAkNgCe
# 2019-11-06 14:27:17 aPYjUvtRIVqnKDuJfMWFTrAZLNSimGpHlkeE
# 2019-11-06 14:27:17 RcVA
while($true) {(Get-Date -Format "yyyy-dd-MM HH:mm:ss").ToString() + " " + (-join ((65..90) + (97..122) | Get-Random -Count (get-random -minimum 1 -maximum 50) | % {[char]$_})) | out-file test.log -append -encoding ASCII; start-sleep -milliseconds 100}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment