Fix referrer parsing.
This commit is contained in:
parent
54438f94cf
commit
6f41ddd166
2 changed files with 7 additions and 3 deletions
2
build-container.sh
Normal file
2
build-container.sh
Normal file
|
@ -0,0 +1,2 @@
|
|||
#!/bin/sh
|
||||
docker build ./source/ -t stevedinn/caddy-log-converter:latest
|
|
@ -21,7 +21,9 @@ $outputWriter = New-Object -TypeName System.IO.StreamWriter -ArgumentList @($out
|
|||
Get-Content -Tail $lines -Wait -Path $inFile | ForEach-Object {
|
||||
$l = ConvertFrom-Json -InputObject $_
|
||||
$r = $l.request;
|
||||
$ua = $r.headers.'User-Agent'
|
||||
|
||||
$userAgent = $r.headers.'User-Agent' | Select-Object -First 1
|
||||
$referer = $r.headers.Referer | Select-Object -First 1
|
||||
|
||||
$null = $builder.Clear()
|
||||
$null = $builder.Append($r.remote_ip)
|
||||
|
@ -40,9 +42,9 @@ Get-Content -Tail $lines -Wait -Path $inFile | ForEach-Object {
|
|||
$null = $builder.Append(" ")
|
||||
$null = $builder.Append($l.size)
|
||||
$null = $builder.Append(" """)
|
||||
$null = $builder.Append($r.headers.Referer)
|
||||
$null = $builder.Append($referer)
|
||||
$null = $builder.Append(""" """)
|
||||
$null = $builder.Append("$ua")
|
||||
$null = $builder.Append($userAgent)
|
||||
$null = $builder.Append("""")
|
||||
|
||||
$commonLog = $builder.ToString()
|
||||
|
|
Loading…
Reference in a new issue