SQL Agent step won't write to SQL log directory

  • I have a SQL 2019 (RTM-CU14) installation with an Agent job which constantly fails with the error:

    Unable to open Step output file.  The step failed.

    The "Output file" value attempts to write to the SQL error log directory using agent tokens - although I've tried with a fully specified filename as well. Using C:\Temp is fine so I'm guessing it's a permissions issue.

    I have several T-SQL job steps which write to this location (with tokens) without issue but this CmdExec one fails every time. The step has a "Run as" value of "SQL Server Agent Service Account" and I can see this is being used in the job history.

    Any ideas why a CmdExec step would have a permissions issue when a T-SQL one doesn't?

  • Did someone modify the SQLAgent service account after the installation of this sqlserver instance ?

     

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • Not that I'm aware of. I performed the install and selected the AD account to run the SQL Agent service which is currently the one in use.

  • double check the path to the sqlagent step log file. Something must be off

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • One other thought - is the folder a network share?  If so, you will need to use the FQDN path to the location (ie //server.domain.com/share/path) rather than the letter (ie z:\path).

    The above is all just my opinion on what you should do. 
    As with all advice you find on a random internet forum - you shouldn't blindly follow it.  Always test on a test server to see if there is negative side effects before making changes to live!
    I recommend you NEVER run "random code" you found online on any system you care about UNLESS you understand and can verify the code OR you don't care if the code trashes your system.

  • Johan Bijnens wrote:

    Did someone modify the SQLAgent service account after the installation of this sqlserver instance ?

    Just to verify this, how can I check the membership of the MSSQL$INSTANCENAME group? Can't find it in Local Users and Groups :-/

  • that is a (local) windows managed account, not a group!

     

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • Just ran into this issue on an Azure VM. It was silently failing to log except for cmdexec steps that would generate an error.

    The install process didn't give the sql agent service permission to access the log directory.

    Needed to give the 'NT Service\SQLSERVERAGENT' modify permissions on the 'C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\Log' folder.

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply