<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Splunk HF exports logs using a CLI command as a Linux crontab in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Splunk-HF-exports-logs-using-a-CLI-command-as-a-Linux-crontab/m-p/651453#M225221</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;when you are running commands from cron, you must remember that there is no sourced environments. Usually you should use some wrapped script to:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;source your user's shell environment including env vars + etc.&lt;/LI&gt;&lt;LI&gt;run your commands / scripts with full paths!&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;In your case this means e.g.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;#!/bin/bash
source ~&amp;lt;your user&amp;gt;/.bash_login
source ~&amp;lt;your user&amp;gt;/.bashrc
cd &amp;lt;where ever you thing you should be&amp;gt;
/opt/splunk/bin/splunk .....&lt;/LI-CODE&gt;&lt;P&gt;Of course you should add needed error checks after commands etc.&lt;/P&gt;&lt;P&gt;r. Ismo&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 21 Jul 2023 10:39:58 GMT</pubDate>
    <dc:creator>isoutamo</dc:creator>
    <dc:date>2023-07-21T10:39:58Z</dc:date>
    <item>
      <title>Splunk HF exports logs using a CLI command as a Linux crontab?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-HF-exports-logs-using-a-CLI-command-as-a-Linux-crontab/m-p/651444#M225218</link>
      <description>&lt;P&gt;I'm new to Splunk Enterprise, and my task is to forward logs from Splunk HF (AWS EC2 instance) to an AWS Cloud Watch log group.&lt;/P&gt;
&lt;P&gt;I tried to export the logs using CLI commands and stored them on the Splunk HF server locally. Then, I used the Cloud Watch agent to send the logs to the Cloud Watch log group.&lt;/P&gt;
&lt;P&gt;please refer the below Splunk cli command for export the logs&lt;/P&gt;
&lt;P&gt;#./splunk search "index::***** sourcetype::linux_audit" -output rawdata -maxout 0 -max_time 5 -auth splunk:***** &amp;gt;&amp;gt; /opt/linux-Test01.log&lt;/P&gt;
&lt;P&gt;The challenge I'm facing is that when I run the CLI command using a Linux crontab, it does not export the logs.&lt;/P&gt;
&lt;P&gt;Are there any other solutions or guidance available to resolve this issue?&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2023 17:53:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-HF-exports-logs-using-a-CLI-command-as-a-Linux-crontab/m-p/651444#M225218</guid>
      <dc:creator>sarvananth</dc:creator>
      <dc:date>2023-07-21T17:53:34Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk HF exports logs using a CLI command as a Linux crontab</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-HF-exports-logs-using-a-CLI-command-as-a-Linux-crontab/m-p/651453#M225221</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;when you are running commands from cron, you must remember that there is no sourced environments. Usually you should use some wrapped script to:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;source your user's shell environment including env vars + etc.&lt;/LI&gt;&lt;LI&gt;run your commands / scripts with full paths!&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;In your case this means e.g.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;#!/bin/bash
source ~&amp;lt;your user&amp;gt;/.bash_login
source ~&amp;lt;your user&amp;gt;/.bashrc
cd &amp;lt;where ever you thing you should be&amp;gt;
/opt/splunk/bin/splunk .....&lt;/LI-CODE&gt;&lt;P&gt;Of course you should add needed error checks after commands etc.&lt;/P&gt;&lt;P&gt;r. Ismo&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2023 10:39:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-HF-exports-logs-using-a-CLI-command-as-a-Linux-crontab/m-p/651453#M225221</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2023-07-21T10:39:58Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk HF exports logs using a CLI command as a Linux crontab</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-HF-exports-logs-using-a-CLI-command-as-a-Linux-crontab/m-p/651858#M225328</link>
      <description>&lt;P&gt;Hi R.Ismo,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;yes, it is working fine, and thank you very much for your help.&lt;BR /&gt;Is it possible to export the logs last 5 minutes using a CLI command?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jul 2023 09:50:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-HF-exports-logs-using-a-CLI-command-as-a-Linux-crontab/m-p/651858#M225328</guid>
      <dc:creator>sarvananth</dc:creator>
      <dc:date>2023-07-25T09:50:37Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk HF exports logs using a CLI command as a Linux crontab</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-HF-exports-logs-using-a-CLI-command-as-a-Linux-crontab/m-p/651864#M225330</link>
      <description>&lt;P&gt;Basically just …/splunk search ….just check correct syntax from docs. Thera are also defined output format etc. you should remember that some events could come later, so if you just export all events from last 5min you probably miss some….&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jul 2023 10:35:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-HF-exports-logs-using-a-CLI-command-as-a-Linux-crontab/m-p/651864#M225330</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2023-07-25T10:35:59Z</dc:date>
    </item>
  </channel>
</rss>

