<?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: Writing regex for specific /var/log/*.log files in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Writing-regex-for-specific-var-log-log-files/m-p/749599#M119088</link>
    <description>&lt;P&gt;So the stanza&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[monitor:///var/log/abc/def.log]
sourcetype = alphabet_log&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;will take precedence over the already present [monitor:///var/log] stanza?&lt;/P&gt;</description>
    <pubDate>Fri, 11 Jul 2025 06:11:54 GMT</pubDate>
    <dc:creator>Na_Kang_Lim</dc:creator>
    <dc:date>2025-07-11T06:11:54Z</dc:date>
    <item>
      <title>Writing regex for specific /var/log/*.log files</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Writing-regex-for-specific-var-log-log-files/m-p/749596#M119086</link>
      <description>&lt;P&gt;The Splunk app for Linux already provided a stanza for collecting all the .log files in the /var/log folder ([monitor::///var/log]). But what if I want to write specific regex/transformations for specific .log file, given its path.&lt;/P&gt;&lt;P&gt;For example, I want to apply transformation by writing specific stanzas in props.conf and transforms.conf for file /var/log/abc/def.log and /var/log/abc/ghi.log.&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to make these have the same sourcetype as "alphabet_log" and then write its regex functions?&lt;/P&gt;&lt;P&gt;I also have a question regarding the docs from Splunk&lt;/P&gt;&lt;P&gt;In the props.conf docs, it stated that:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;For settings that are specified in multiple categories of matching [&amp;lt;spec&amp;gt;]
stanzas, [host::&amp;lt;host&amp;gt;] settings override [&amp;lt;sourcetype&amp;gt;] settings.
Additionally, [source::&amp;lt;source&amp;gt;] settings override both [host::&amp;lt;host&amp;gt;]
and [&amp;lt;sourcetype&amp;gt;] settings.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;What does "override" here mean? Does it override everything, or it combines and only override the duplicate configs?&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jul 2025 05:38:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Writing-regex-for-specific-var-log-log-files/m-p/749596#M119086</guid>
      <dc:creator>Na_Kang_Lim</dc:creator>
      <dc:date>2025-07-11T05:38:25Z</dc:date>
    </item>
    <item>
      <title>Re: Writing regex for specific /var/log/*.log files</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Writing-regex-for-specific-var-log-log-files/m-p/749598#M119087</link>
      <description>&lt;P&gt;For onboarding logs from /var/log/abc/def.log and /var/log/abc/ghi.log&lt;BR /&gt;You can add inputs.conf with below,&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[monitor:///var/log/abc/def.log]
sourcetype = alphabet_log

[monitor:///var/log/abc/ghi.log]
sourcetype = alphabet_log


And props.conf
[source::/var/log/abc/def.log]
TRANSFORMS-apply_def = def_log_transform

[source::/var/log/abc/ghi.log]
TRANSFORMS-apply_ghi = ghi_log_transform

Transforms.conf
[def_log_transform]
REGEX = your_regex_for_def_log
FORMAT = field_name::value
DEST_KEY = FIELD_NAME

[ghi_log_transform]
REGEX = your_regex_for_ghi_log
FORMAT = another_field::value
DEST_KEY = FIELD_NAME
&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Override means, If the same setting (e.g., TRANSFORMS-xyz) is present in both [source::...] and [sourcetype::...], then the value from [source::...] overrides the one from [sourcetype::...]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Prewin&lt;BR /&gt;Splunk Enthusiast | Always happy to help! If this answer helped you, please consider marking it as the solution or giving a Karma. Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jul 2025 05:55:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Writing-regex-for-specific-var-log-log-files/m-p/749598#M119087</guid>
      <dc:creator>PrewinThomas</dc:creator>
      <dc:date>2025-07-11T05:55:04Z</dc:date>
    </item>
    <item>
      <title>Re: Writing regex for specific /var/log/*.log files</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Writing-regex-for-specific-var-log-log-files/m-p/749599#M119088</link>
      <description>&lt;P&gt;So the stanza&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[monitor:///var/log/abc/def.log]
sourcetype = alphabet_log&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;will take precedence over the already present [monitor:///var/log] stanza?&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jul 2025 06:11:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Writing-regex-for-specific-var-log-log-files/m-p/749599#M119088</guid>
      <dc:creator>Na_Kang_Lim</dc:creator>
      <dc:date>2025-07-11T06:11:54Z</dc:date>
    </item>
    <item>
      <title>Re: Writing regex for specific /var/log/*.log files</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Writing-regex-for-specific-var-log-log-files/m-p/749600#M119089</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/308546"&gt;@Na_Kang_Lim&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;The above we highlighted about props and transforms. And for inputs.conf,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Splunk matches the most specific generally [monitor://] stanza for a file.&lt;BR /&gt;If both stanzas exist, the more specific path (/var/log/abc/def.log) overrides the more general one (/var/log).&lt;/P&gt;&lt;P&gt;So answering to your question, def.log will use sourcetype = alphabet_log, even if [monitor:///var/log] has a different sourcetype or settings.&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Prewin&lt;BR /&gt;Splunk Enthusiast | Always happy to help! If this answer helped you, please consider marking it as the solution or giving a Karma. Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jul 2025 06:31:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Writing-regex-for-specific-var-log-log-files/m-p/749600#M119089</guid>
      <dc:creator>PrewinThomas</dc:creator>
      <dc:date>2025-07-11T06:31:33Z</dc:date>
    </item>
    <item>
      <title>Re: Writing regex for specific /var/log/*.log files</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Writing-regex-for-specific-var-log-log-files/m-p/749604#M119090</link>
      <description>&lt;P&gt;1. Addon for *nix does contain some questionable items. They are good for demonstrating functionality but not necessarily for production use. I definitely wouldn't just bulk ingest everything under /var/log with one sourcetype. You mightjJust disable the "global" /var/log montor stanza and ingest each needed file/dir with its own sourcetype. It's easier than pulling all files at once and overwriting the sourcetype later (like &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/28010"&gt;@PrewinThomas&lt;/a&gt;&amp;nbsp;showed). But you can do it using overriding settings on input.&lt;/P&gt;&lt;P&gt;2. In case of the sourcetype assignment, you can override the sourcetype set at input level by defining a props.conf source:: stanza with a sourcetype assignment.&lt;/P&gt;&lt;P&gt;If you create an entry in inputs.conf&lt;/P&gt;&lt;PRE&gt;[monitor:///var/log]&lt;BR /&gt;sourcetype=s1&lt;/PRE&gt;&lt;P&gt;but add to props.conf&lt;/P&gt;&lt;PRE&gt;[source::.../var/log/apache/access.log]&lt;BR /&gt;sourcetype=s2&lt;/PRE&gt;&lt;P&gt;All files from /var/log will be ingested with sourcetype of s1 except for the access.log which will have a sourcetype s2.&lt;/P&gt;&lt;P&gt;3. Overriding in that quote you posted means that if there are multiple "the same" config items coming from different stanzas or config files one of those has precedence over anotner and only one of them will be used. For example, if you have a general sourcetype setting&lt;/P&gt;&lt;PRE&gt;[s2]&lt;BR /&gt;LINE_BREAKER=(\r\n)+&lt;/PRE&gt;&lt;P&gt;and a source-specific one&lt;/P&gt;&lt;PRE&gt;[source::.../var/log/apache/access.log]&lt;BR /&gt;LINE_BREAKER=(##)&lt;/PRE&gt;&lt;P&gt;For any s2-sourcetyped file line breaker will be assigned according to the general sourcetype rule except for the access.log, which will be line broken according to the source-specified setting which takes precedence.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jul 2025 07:02:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Writing-regex-for-specific-var-log-log-files/m-p/749604#M119090</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2025-07-11T07:02:00Z</dc:date>
    </item>
  </channel>
</rss>

