Skip to content

When used in a systemd service add a lot of log in journal #38

@fabamb

Description

@fabamb

I'm running a pwsh script that uses PSSQLite and this script is launched from a custom unit

systemctl --user start controller

and this produces a lot of log in journal, below an example

How avoid such a mess?

 systemctl status --user controller
● controller.service - Template Distribution Controller (pwsh)
     Loaded: loaded (/home/template-distribution/.config/systemd/user/controller.service; enabled; preset: enabled)
     Active: active (running) since Sun 2025-09-21 21:17:13 CEST; 52s ago
   Main PID: 1585246 (pwsh)
      Tasks: 80 (limit: 4548)
     Memory: 501.0M (peak: 517.8M)
        CPU: 24.296s
     CGroup: /user.slice/user-1001.slice/user@1001.service/app.slice/controller.service
             ├─1585246 /usr/bin/pwsh -NoLogo -NoProfile -File /opt/template-distribution/bin/controllers/Controller.ps1 -xmlFile /opt/template-distribution/conf/configuration.xml -NoInteractive -NoClearHost -Mode controllers
             ├─1585279 /opt/microsoft/powershell/7/pwsh -s -NoLogo -NoProfile -wd /opt/template-distribution/bin
             ├─1585285 /opt/microsoft/powershell/7/pwsh -s -NoLogo -NoProfile -wd /opt/template-distribution/bin
             └─1585294 /opt/microsoft/powershell/7/pwsh -s -NoLogo -NoProfile -wd /opt/template-distribution/bin

Sep 21 21:17:26 cdpccxx-tplds01.cloud.local powershell[1585285]: (7.5.3:4:80) [Pipeline_Detail:ExecutePipeline.Method.Informational] CommandInvocation(Add-Type): "Add-Type"
                                                                 ParameterBinding(Add-Type): name="TypeDefinition"; value="                using System;
                                                                                 using System.Data;
                                                                                 using System.Management.Automation;
                                                                 
                                                                                 public class DBNullScrubber
                                                                                 {
                                                                                     public static PSObject DataRowToPSObject(DataRow row)
                                                                                     {
                                                                                         PSObject psObject = new PSObject();
                                                                 
                                                                                         if (row != null && (row.RowState & DataRowState.Detached) != DataRowState.Detached)
                                                                                         {
                                                                                             foreach (DataColumn column in row.Table.Columns)
                                                                                             {
                                                                                                 Object value = null;
                                                                                                 if (!row.IsNull(column))
                                                                                                 {
                                                                                                     value = row[column];
                                                                                                 }
                                                                 
                                                                                                 psObject.Properties.Add(new PSNoteProperty(column.ColumnName, value));
                                                                                             }
                                                                                         }
                                                                 
                                                                                         return psObject;
                                                                                     }
                                                                                 }"
                                                                 ParameterBinding(Add-Type): name="ReferencedAssemblies"; value="System.Data.Common, System.Management.Automation, System.ComponentModel.TypeConverter"
                                                                 ParameterBinding(Add-Type): name="ErrorAction"; value="Stop"
                                                                 
                                                                 
                                                                 Context:
                                                                         Severity = Informational
                                                                         Host Name = ServerRemoteHost
                                                                         Host Version = 7.5.3
                                                                         Host ID = 0c06ac38-1d3e-4729-ac02-64f2de66df6e
                                                                         Host Application = /opt/microsoft/powershell/7/pwsh.dll -s -NoLogo -NoProfile -wd /opt/template-distribution/bin
                                                                         Engine Version = 7.5.3
                                                                         Runspace ID = 99348617-7253-4b59-975c-5a3f911416fb
                                                                         Pipeline ID = 3
                                                                         Command Name = Add-Type
                                                                         Command Type = Cmdlet
                                                                         Script Name = /usr/local/share/powershell/Modules/PSSQLite/1.1.0/Invoke-SqliteQuery.ps1
                                                                         Command Path = 
                                                                         Sequence Number = 1547
                                                                         User = cdpccxx-tplds01\template-distribution
                                                                         Connected User = 
                                                                         Shell ID = Microsoft.PowerShell
                                                                 
                                                                 
                                                                 User Data:
Sep 21 21:17:28 cdpccxx-tplds01.cloud.local powershell[1585285]: (7.5.3:4:80) [Pipeline_Detail:ExecutePipeline.Method.Informational] CommandInvocation(Add-Type): "Add-Type"
                                                                 ParameterBinding(Add-Type): name="TypeDefinition"; value="                using System;
                                                                                 using System.Data;
                                                                                 using System.Management.Automation;
                                                                 
                                                                                 public class DBNullScrubber
                                                                                 {
                                                                                     public static PSObject DataRowToPSObject(DataRow row)
                                                                                     {
                                                                                         PSObject psObject = new PSObject();
                                                                 
                                                                                         if (row != null && (row.RowState & DataRowState.Detached) != DataRowState.Detached)
                                                                                         {
                                                                                             foreach (DataColumn column in row.Table.Columns)
                                                                                             {
                                                                                                 Object value = null;
                                                                                                 if (!row.IsNull(column))
                                                                                                 {
                                                                                                     value = row[column];
                                                                                                 }
                                                                 
                                                                                                 psObject.Properties.Add(new PSNoteProperty(column.ColumnName, value));
                                                                                             }
                                                                                         }
                                                                 
                                                                                         return psObject;
                                                                                     }
                                                                                 }"
                                                                 ParameterBinding(Add-Type): name="ReferencedAssemblies"; value="System.Data.Common, System.Management.Automation, System.ComponentModel.TypeConverter"
                                                                 ParameterBinding(Add-Type): name="ErrorAction"; value="Stop"
                                                                 
                                                                 
                                                                 Context:
                                                                         Severity = Informational
                                                                         Host Name = ServerRemoteHost
                                                                         Host Version = 7.5.3
                                                                         Host ID = 0c06ac38-1d3e-4729-ac02-64f2de66df6e
                                                                         Host Application = /opt/microsoft/powershell/7/pwsh.dll -s -NoLogo -NoProfile -wd /opt/template-distribution/bin
                                                                         Engine Version = 7.5.3
                                                                         Runspace ID = 99348617-7253-4b59-975c-5a3f911416fb
                                                                         Pipeline ID = 3
                                                                         Command Name = Add-Type
                                                                         Command Type = Cmdlet
                                                                         Script Name = /usr/local/share/powershell/Modules/PSSQLite/1.1.0/Invoke-SqliteQuery.ps1
                                                                         Command Path = 
                                                                         Sequence Number = 1768
                                                                         User = cdpccxx-tplds01\template-distribution
                                                                         Connected User = 
                                                                         Shell ID = Microsoft.PowerShell
                                                                 
                                                                 
                                                                 User Data:
Sep 21 21:17:28 cdpccxx-tplds01.cloud.local powershell[1585285]: (7.5.3:4:80) [Pipeline_Detail:ExecutePipeline.Method.Informational] CommandInvocation(Add-Type): "Add-Type"
                                                                 ParameterBinding(Add-Type): name="TypeDefinition"; value="                using System;
                                                                                 using System.Data;
                                                                                 using System.Management.Automation;
                                                                 
                                                                                 public class DBNullScrubber
                                                                                 {
                                                                                     public static PSObject DataRowToPSObject(DataRow row)
                                                                                     {
                                                                                         PSObject psObject = new PSObject();
                                                                 
                                                                                         if (row != null && (row.RowState & DataRowState.Detached) != DataRowState.Detached)
                                                                                         {
                                                                                             foreach (DataColumn column in row.Table.Columns)
                                                                                             {
                                                                                                 Object value = null;
                                                                                                 if (!row.IsNull(column))
                                                                                                 {
                                                                                                     value = row[column];
                                                                                                 }
                                                                 
                                                                                                 psObject.Properties.Add(new PSNoteProperty(column.ColumnName, value));
                                                                                             }
                                                                                         }
                                                                 
                                                                                         return psObject;
                                                                                     }
                                                                                 }"
                                                                 ParameterBinding(Add-Type): name="ReferencedAssemblies"; value="System.Data.Common, System.Management.Automation, System.ComponentModel.TypeConverter"
                                                                 ParameterBinding(Add-Type): name="ErrorAction"; value="Stop"
                                                                 
                                                                 
                                                                 Context:
                                                                         Severity = Informational
                                                                         Host Name = ServerRemoteHost
                                                                         Host Version = 7.5.3
                                                                         Host ID = 0c06ac38-1d3e-4729-ac02-64f2de66df6e
                                                                         Host Application = /opt/microsoft/powershell/7/pwsh.dll -s -NoLogo -NoProfile -wd /opt/template-distribution/bin
                                                                         Engine Version = 7.5.3
                                                                         Runspace ID = 99348617-7253-4b59-975c-5a3f911416fb
                                                                         Pipeline ID = 3
                                                                         Command Name = Add-Type
                                                                         Command Type = Cmdlet
                                                                         Script Name = /usr/local/share/powershell/Modules/PSSQLite/1.1.0/Invoke-SqliteQuery.ps1
                                                                         Command Path = 
                                                                         Sequence Number = 1803
                                                                         User = cdpccxx-tplds01\template-distribution
                                                                         Connected User = 
                                                                         Shell ID = Microsoft.PowerShell
                                                                 
                                                                 
                                                                 User Data:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions