Skip to content

Instantly share code, notes, and snippets.

@TiloGit
Last active March 23, 2022 19:34
Show Gist options
  • Save TiloGit/071105f053e1961146dcfe0622d1915c to your computer and use it in GitHub Desktop.
Save TiloGit/071105f053e1961146dcfe0622d1915c to your computer and use it in GitHub Desktop.
log4j2 for azure log monitoring file ingestion
<RollingFile name="VFLOGMON"
filePattern="${sys:log.dir}/VFLOGMON/MyFlow-LogMon-%d{yyyy-MM-dd}-%i.log"
immediateFlush="true">
<PatternLayout alwaysWriteExceptions="false"
pattern="%d %-5p [%t] %C{2} (%F:%L) - %enc{%m}{CRLF} %replace{%throwable}{[\r|\n]}{|}%n"/>
<Policies>
<TimeBasedTriggeringPolicy interval="1"
modulate="true"/>
<SizeBasedTriggeringPolicy size="22 MB"/>
</Policies>
<DirectWriteRolloverStrategy maxFiles="10"> <!-- maxFiles: only for created in the time period above (so 1 day) -->
<Delete
basePath="${sys:log.dir}/VFLOGMON"
maxDepth="1">
<IfFileName glob="MyFlow-LogMon-*-*.log"/>
<!-- <IfLastModified age="P60D"/> -->
<IfAccumulatedFileCount exceeds="14" />
</Delete>
</DirectWriteRolloverStrategy>
</RollingFile>
@TiloGit
Copy link
Author

TiloGit commented Mar 23, 2022

to support "Collect custom logs with Log Analytics agent in Azure Monitor" https://docs.microsoft.com/en-us/azure/azure-monitor/agents/data-sources-custom-logs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment